This is a migrated thread and some comments may be shown as answers.

Column sorting and retaining filter

1 Answer 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
hchattaway
Top achievements
Rank 1
hchattaway asked on 29 Aug 2008, 05:36 PM
I am using the RadGrid with a LinqDatasource, which is working great. I made the columns sortable and I have a couple of fields above the grid I use to filter the grid. The filtering works great also, but when I click on a column header, the filtering is not kept. Do I need to recreate the filter on each click of a column header?

I am creating the filter in the codebehind like this:
Parameter Projectparam = new Parameter(); 
Projectparam.Name = "ProjectID"
Projectparam.DefaultValue = this.UserInfo.Profile.GetPropertyValue("ProjectID").ToString(); 
Projectparam.Type = TypeCode.Int32; 
TicketListDataSource.WhereParameters.Add(Projectparam); 
 
TicketListDataSource.Where = "ProjectID == @ProjectID" 

Should this filtering logic be run each time a column header is clicked? Using the "OnSortCommand"?
Thanks!
Harold

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 01 Sep 2008, 12:54 PM
Hi Harold,

Generally if you bind the grid using DataSourceID all these will be done automatically. Please check this example:
http://demos.telerik.com/aspnet/Prometheus/Grid/Examples/GeneralFeatures/ASPNET35/DefaultCS.aspx

Sincerely yours,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
hchattaway
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or