Hi,
I am enabling filtering and sorting on my rad Grid and displaying the data.
here my requirement is after diaplaying data.. when a uaser clicks on a column/columns to sort I want to fetch that colun name and its data type and its sort order. And in the same way when a user filters a column/columns I want to get that column name and the filtering type value.
I need all this data for later use in my application ( when a user selects his sort/filter criteria I will save this data and when the same user views tha data again I will load the grid with his default sort/filter criteria, this sort/filter criteria is per user).
How can I achieve this?
Thanks,
I am enabling filtering and sorting on my rad Grid and displaying the data.
here my requirement is after diaplaying data.. when a uaser clicks on a column/columns to sort I want to fetch that colun name and its data type and its sort order. And in the same way when a user filters a column/columns I want to get that column name and the filtering type value.
I need all this data for later use in my application ( when a user selects his sort/filter criteria I will save this data and when the same user views tha data again I will load the grid with his default sort/filter criteria, this sort/filter criteria is per user).
How can I achieve this?
Thanks,
7 Answers, 1 is accepted
0
Jayesh Goyani
Top achievements
Rank 2
answered on 03 Oct 2011, 12:55 PM
Hello,
Get filter detail
get sort detail
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/sort/defaultcs.aspx
Let me know if any concern.
Thanks,
Jayesh Goyani
Get filter detail
protected void RadGrid1_ItemCommand(object source, Telerik.WebControls.GridCommandEventArgs e){if (e.CommandName == RadGrid.FilterCommandName){string columnname = ((Pair)e.CommandArgument).Second;string filtertyype = ((Pair)e.CommandArgument).First;}}get sort detail
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/sort/defaultcs.aspx
Let me know if any concern.
Thanks,
Jayesh Goyani
0
Anzar
Top achievements
Rank 2
answered on 05 Jan 2013, 08:52 AM
Hi Jayesh,
What is the '
Thanks & Regards
Anzar.M
string columnname = ((Pair)e.CommandArgument).Second;Pair' ?.Thanks & Regards
Anzar.M
0
Jayesh Goyani
Top achievements
Rank 2
answered on 05 Jan 2013, 10:54 AM
Hello,
pair is the keyword/class from .net framework (System.Web.UI.pair).
for more info please check below link.
http://msdn.microsoft.com/en-in/library/system.web.ui.pair.aspx
Thanks,
Jayesh Goyani
pair is the keyword/class from .net framework (System.Web.UI.pair).
for more info please check below link.
http://msdn.microsoft.com/en-in/library/system.web.ui.pair.aspx
Thanks,
Jayesh Goyani
0
Anzar
Top achievements
Rank 2
answered on 07 Jan 2013, 05:10 AM
Hello Jayesh,
Its working properly. By similarly, How to get the column unique name while sorting?.
Thanks & Regards
Anzar.M
Its working properly. By similarly, How to get the column unique name while sorting?.
Thanks & Regards
Anzar.M
0
Shinu
Top achievements
Rank 2
answered on 07 Jan 2013, 06:16 AM
Hi,
You can get the column UniqueName when the column is sorted as shown below.
C#:
Thanks,
Shinu.
You can get the column UniqueName when the column is sorted as shown below.
C#:
protected void RadGrid2_SortCommand(object sender, GridSortCommandEventArgs e){ string datafield = e.SortExpression; //access the column Datafield foreach (GridColumn col in RadGrid2.MasterTableView.Columns) { if (col is GridBoundColumn && (col as GridBoundColumn).DataField == e.SortExpression) { string uniquename = col.UniqueName; // column uniqueName(of bound column for example) } }}Thanks,
Shinu.
0
Anzar
Top achievements
Rank 2
answered on 07 Jan 2013, 08:44 AM
HI Shinu,
how to get it on item command without using for each loop?.
Thanks & Regards
Anzar.M
how to get it on item command without using for each loop?.
Thanks & Regards
Anzar.M
0
Anish
Top achievements
Rank 1
answered on 07 Jan 2013, 09:52 AM
protected void rdgOther_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "Sort") { string datafield = Convert.ToString(e.CommandArgument); foreach (GridColumn col in rdgOther.MasterTableView.Columns) { if (col is GridBoundColumn && (col as GridBoundColumn).DataField == Convert.ToString(e.CommandArgument)) { string uniquename = col.UniqueName; } else if (col is GridTemplateColumn && (col as GridTemplateColumn).DataField == Convert.ToString(e.CommandArgument)) { string uniquename = col.UniqueName; } } } }This is how to Get in item command with for each loop. please Tell me without For each loop
Thanks & Regards
Anish Sethu