Column sorting and retaining filter

2 posts, 0 answers
  1. hchattaway
    hchattaway avatar
    67 posts
    Member since:
    Feb 2007

    Posted 29 Aug 2008 Link to this post

    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.Where = "ProjectID == @ProjectID" 

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

  2. Vlad
    Vlad avatar
    11100 posts

    Posted 01 Sep 2008 Link to this post

    Hi Harold,

    Generally if you bind the grid using DataSourceID all these will be done automatically. Please check this example:

    Sincerely yours,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top