Forms Data Controls :: Gridvew Filtering And Getting It To Work With Sorting?

Mar 24, 2010

I have a gridview and a drop down filter on the same page. The dropdown code :

protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList2.SelectedValue == "LineManager")
{
ApproversListDB.FilterExpression = "Approver = '{0}'";
ApproversListDB.FilterParameters.Add("@Approver", strAccount);
}
else if (DropDownList2.SelectedValue == "AssignmentManager")
{
ApproversListDB.FilterExpression = "AssignmentApprover = '{0}'";
ApproversListDB.FilterParameters.Add("@AssignmentApprover", strAccount);
//ApproversListDB.FilterExpression = "AssignmentApprover=" + userid;
}
}

This filter / dropdown works fine....apart from if anyone sorts or pages the grid in which case it looses the filter expression. I have looked at a few examples on the web and cant get my head round it (ie

[URL]

PS I connect my grid to the following datasource using the GUI - ie nothing databinding in the code behind apart from page refresh

<asp:SqlDataSource ID="ApproversListDB" runat="server"
ConnectionString="<%$ ConnectionStrings:PDRConnect %>"
SelectCommand="p_PDRsForMyApprovalTable"
ProviderName="<%$ ConnectionStrings:PDRConnect.ProviderName %>"
SelectCommandType="StoredProcedure">
<SelectParameters>
<custom:UserNameParameter Name="userName" />
</SelectParameters>
</asp:SqlDataSource>

View 3 Replies


Similar Messages:

Forms Data Controls :: Sorting And Filtering Collections?

Jan 21, 2010

I have a BLL that takes data from DB into datatables and for each datatable there are functions that transform them into Collections of the corresponding class.

When I put the data in a Collection into GridView through ObjectDataSource I don't have the option to click on the header of a column and get the data sorted. The headers are only clickable when DataTable is passed to the ObjectDataSource.

How can I get arround this problem without passing DataTables to the ODS?

View 1 Replies

Data Controls :: Hindi Alphabet Paging Sorting Filtering In GridView

May 7, 2015

Alphabetic paging in GridView from [URL] ....

but for searching in Hindi of my web page my problem is 

LinkButton अ
LinkButton आ
अ          आ           इ         ई          ऊ
-----------------------------------------
EmpID       EmpName   

1              अमर 
2              अमीर 
------------------------------------------

Press Linkbutton A to Search belong to EmpName A just like these portel to find people record..........

View 1 Replies

Forms Data Controls :: Sorting In Gridview Doesnt Work?

Jun 9, 2010

[Code]....

I have tryed this sorting code here in first post http://forums.asp.net/t/956540.aspx but it doesnt work. any tips?

View 2 Replies

Forms Data Controls :: Filtering Records Returned Versus Filtering At The Datasource

Mar 14, 2010

I have a standard gridview, with the standard paging and sorting interface enabled.The application holds appointments for three organisational units, with a maximum of 3000 appointment records being returned across all three units. The appointment records are quite small.

The choice I am faced with is to:

1. Have an Org Unit dropdown which returns to the datasource on change of selection and at inital databind, and returns appointment records for one org unit at a time i.e. approx 1000 records.

2. Have the objectdatasource return all 3000 appointment records for all org units at initial databind, and filter the objectdatasource by org unit on change of selection, thereby saving a trip to the datasource.

I guess the question boils down to identifying the point at which querying the datasource by org unit is more efficient than filtering the records returned by org unit.

Is 3000 records a lot for a gridview to be paging and sorting etc.

View 3 Replies

Forms Data Controls :: Sorting GridView Doesn't Work After Using A Select Statement Involving: FOR XML Path('')?

Feb 8, 2010

I have a GridView; one of the columns displays concatenated records from a tables. to extract the records that are going to be concatenated and put in this column, i have used: FOR XML path('') and it works just fine for displaying those records. the problem now is the whole gridview can not be sorted anymore and gives me a 404, document not found, error whenever i try to click the columns to sort. here is my select statement for my sql datasource select command:

SqlDataSource2.SelectCommand = "Select a1.*, keyword = substring( ( SELECT DISTINCT ', ' + keywordName FROM keywords JOIN key_mm_articles ON key_mm_articles.keywordID = keywords.keywordID WHERE key_mm_articles.articleID = a1.articleID FOR XML path(''), elements ),2,500) FROM articles a1 WHERE title LIKE '" & titles & "' Order By a1.articleID"

View 4 Replies

Forms Data Controls :: Add Columns Dynamically To Gridvew In Codebehind?

Mar 15, 2010

I hve this gridview

v style="overflow: auto; height: 250px">
<asp:UpdatePanel UpdateMode="Conditional" ID="up1" runat="server">
<ContentTemplate>
<asp:GridView ID="gv" runat="server" DataKeyNames="row_id" AllowSorting="True" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkDelivery" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sequence No">
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>

i want to add this two columns dynamically to gridvew in codebehind.

View 3 Replies

Forms Data Controls :: Gridvew Pager Next Button Not Responding?

Sep 22, 2010

I implemented the class from this link below: http://gonzalo.name/blog/and when I click on the next button image in the pager row, it does not go to the next page, same thing happens when I change a number in the text box, it does not respond. I stepped through the debugger and it does go to the onNextClicked event but does not do any thing. I have a custom grid control and the only thing different then the instruction is rather than using the page_int event I am using the gridview1_init event for this linegridview1.pagertemplate = new fancypagertemplate)gv);I was just wondering if some one has successfully used this code before? Or what other steps could I take to debug this issue?

View 2 Replies

Forms Data Controls :: Textbox In Gridvew Control Not Saving Keyed In Input?

Sep 20, 2010

I have a textbox in a item template field in a gridview control and a button field as a regular column

See columns below:

<asp:TemplateField>
<ItemTemplate>
<table>
<tr
valign="top">
<td

[Code]....


In this case QtyOrdered is always 1

I have been banging my head on this for about a week now and have not gotten anywhere

View 2 Replies

Forms Data Controls :: How To Access Dataobject Of Parent Gridview Control From Nested Gridvew

May 10, 2010

I have a parent gridview control and a another gridvew control inside parent gridview.I want to access a column named type in parent gridview inside child gridview.And use the value of that column in a javascript function

View 2 Replies

Forms Data Controls :: Getting The Custom Sorting And Paging With Images To Indicate The Sorting Direction In Gridview

Jul 18, 2010

Moderators Note: THIS ISSUE IS BIG FOR ME AND EVEN IF POSSIBLE, GET THE REPLY FROM THE DESIGNER OF GRIDVIEW. I have been looking for him for long. I am really fed up with reviewing a good lot of web pages on how we can possibly customize the gridview to enable sorting and paging. So many sites have listed out a lot of information and so many guidances. But the problem is that one works out fine and the other is a burden. I really feel bad about being given the job of customizing this kind of a gridview which has no user friendly approach to it. Also, this control is rendered without the pager links inside the <tfoot> tag. I have tried the Pear Pager in php. It is that good and easy to use and compared to that, the gridview in asp.net is the worst ever control i have ever tried so far.

1. i can use the images to indicate the sorting direction
2. I can have the custom pager like

[code]

<<Previous 1 2 3 .. 7 Next >>.

[/code]

When i click the next when i am viewing the page at 3 , the pager links should change as

[code]

<<Previous 2 3 4 .. 7 Next >>

[/code]

Kindly look into this type of requirement and firstly tell me whether this is possible with the gridview control. I would like this request even to be escalated to the designers of the gridview control also, so that Microsoft comes out with a reply THAT WORKS and not the kind of stuff like surfing through a lot of links and pages and finally wasting a lot of days precious time and still breaking the head with this useless control. I have spent a lot of time in searching for a perfect way. Not writing a code that is non-standard. I am really serious b'cos I have spent weeks in customizing this control. If I dont get a solid reply atleast now, I am going to generate all the output by HTML content by custom coding.

View 7 Replies

VS 2008 - Creating Gridview User Control With Sorting And Filtering?

Sep 20, 2010

I find myself always repeating code when it comes to gridviews. I want to build a usercontrol so I can just set a datasource andcolumn types etc and I can use the same control over and over in different projects.

View 4 Replies

Forms Data Controls :: Call Control From Gridvew Control For Using?

Jan 16, 2010

How to access call from gridvew control ? Example i want to call Label 3 in gridview for using or for determine value what can i do ?

<asp:UpdatePanel id="UpdatePanel3" runat="server">
<contenttemplate>
<DIV align=left><asp:Label id="lblsearchr" runat="server" Height="19px" Width="564px" ForeColor="#C00000"

[code]...

View 1 Replies

Forms Data Controls :: DataList With Paging And Filtering

Sep 21, 2010

I have made site with datalist and I want to use SQL data filtering and paging, my only problem is that i want to put filtering into paging procedure
paging 1)
Alter Procedure dbo.GetProductsPaged

View 2 Replies

Forms Data Controls :: Filtering On DataList Object

Sep 29, 2010

This seems like a stupid, basic question, but I can't find how to do it (plus I've been doing MVC and haven't done in webforms in ages now) - I've got a DataList object that hooks into an SQLDataSource object, and this works fine. However I need to create a second DataList object for a slightly different set of criteria. Rather than creating a second SQLDataSource object and thus calling the DB twice, I would like to make my SQLDataSource object return a broader set of results (this is easy as I am searching on a column, then each DataList is further filtering on another column) and then further filter these results on each respective DataList - how do I do this?

View 5 Replies

Forms Data Controls :: Filtering GridView Without Datasources?

Mar 29, 2011

I've been filtering my gridviews with the FilterExpression of the underlying ObjectDataSource etc. I am wondering how I can implement filtering on my GridViews if I just directly databind it to a datatable etc?

View 5 Replies

Forms Data Controls :: Filtering Using Three Independent Dropdownlists

Jan 28, 2010

I need to filter data in a View using three dropdownlists that are populated independently of one another. The items in the second ddl are not based on the items in the first, etc. Each ddl is populated using its own sql statement. I want to be able to use each of these dropdownlists independently of the other two, but I want the data that is returned to be based on the values already in the other dropdownlists when I make a selection change.

For example: DDL1 is populated with Horsepower values from its own SQL statement.

DDL2 is populated with Gallons per Minute from its own SQL statement, unrelated to what is chosen in DDL1.

DDL3 is populated with Diameter values from its own SQL statement, unrelated to either of the other DDLs.

I want to be able to make a selection from any of the DDLs and filter data based on the selection, and whatever the current value is for the other two DDLs.

I'm coding in C# and I think I may need to create a delegate and an event to listen for when the SelectedIndexChanged event fires on any of the DDLs. This is slightly more complicated than anything I've coded up to this point, I'm a beginner, and I'm not even sure I'm aiming in the right direction for a solution.

View 8 Replies

Forms Data Controls :: Filtering GridView Using Two DropDownLists?

Jun 9, 2010

I want to filter my gridview using two parameters that come from Dropdownlists. I bind these drops with two linq queries and next I would like to filter my gridview with query that has two parameters that comes from selected values from those drops. Everything is inserted in UpdatePanel. Here is my code:

asp:UpdatePanel
ID="UpdatePanel1"
runat="server"
>

[Code]....

I don't know how to get selectedvalues from dropdownlist and pass them to Bind() function which binds grid view

View 3 Replies

Forms Data Controls :: Filtering A Gridview By UserId?

Dec 30, 2010

I am trying to populate a gridview that returns only the logged in users' records. Specifically, I am getting a blank page when I load the page. To clarify, I get the blank page after successfully logging in to the ASP.Net Membership and do have data to return from the requested table.

I am reaching out to the online community after numerous failed attempts to research the solution and successfully return the desired results through trial and error variations.

ASPX Page

[Code]....

ASPX.vb CodeBehind

[Code]....

<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"

View 4 Replies

Forms Data Controls :: GridView And ObjectDataSource Filtering?

Jan 27, 2010

I'm using a GridView with an ObejctDataSource. The data is provided by a business object and not a DB. It returns a list of people and each person belongs to a group. Now I need to filter data. For example, I need to return list of people in specific groups. How can I specify a list of groups to be able to filter the data ? Could I use SQL like syntax ? I understand the filter expression works only when data is returned as a datatable. But in my business object I maintain data as hashtables and return as List<PeopleInfo>. Do I need to return list as datatable instead ?

View 2 Replies

Forms Data Controls :: Filtering Gridview Twice With Dropdownlist?

Jan 8, 2011

after hours of searching and testing (and found no luck), I came here to ask for your help again. I have a gridview and two dropdownlists. The first dropdownlist (DropDownList1) filters the gridview with Type of Customer. Here is the code on the aspx:

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
AppendDataBoundItems="True">
<asp:ListItem Value="1" Selected="True">A Type</asp:ListItem>

[code]...

View 5 Replies

Forms Data Controls :: Unable To Filtering GridView

May 2, 2010

I'm having a HUGE problem with filtering!! I have a GridView1 with data from sql database (table called Requests) >> using asp:SqlDataSource Control.

and I have 2 columns (CV/ Transcript) which are Hyperlink columns..

I want to filter the data by:

1- GPA: for example view all data with GPA more than 3.55 and so on...

2- Credits: same as GPA (view all data with number of Credits more than 135 and so on...)

3- Dept. Name: it could be DropDownList and the user choose the department he wants to see results from.

View 2 Replies

Forms Data Controls :: Samples On Filtering A Gridview?

Mar 14, 2010

Does anyone know if this asp.net site has some tuturiols that explains in details on how to apply filtering on a gridview? I have searched for it but I couldn't find any tutorials or examples

View 1 Replies

Forms Data Controls :: GridView With Custom Filtering?

Jun 22, 2010

I was looking for a GridView with Custom filtering, all I could find where the filtering is done like

ColumDate=Value user enters

What I need is the user can filter by any condition Eg >, < , =. Like etc the way we do it in queries.

Is this possible? Are any samples already available?

View 9 Replies

How To Do Sorting In A Gridview / Cannot Get It To Work

Mar 10, 2012

I have a Gridview thats is working just fine, but when i click the sort header link, nothing happens !?? it will not sort the data by Desc or Asc

Main grid_view code

Code:
<asp:GridView ID="MySource" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False" DataKeyNames="email_id" AllowPaging="True" emptydatatext="Ingen Data tilgngelig." allowsorting="true" EnableViewState="False" OnSorting="MySource_Sorting"
onRowDataBound="myGridView_RowDataBound">

[code]...

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved