Filtering, AutoGenerateColumns and DataSets

3 posts, 1 answers
  1. Gregory
    Gregory avatar
    47 posts
    Member since:
    Sep 2010

    Posted 20 Sep 2010 Link to this post

    Hello Telerik,

    I have the following RadGrid on my page:

    <telerik:RadGrid ID="rgVehicles" runat="server"
        AutoGenerateColumns="True"
        AllowFilteringByColumn="True" AllowPaging="True"
        AllowSorting="True">
        <PagerStyle Mode="NextPrevAndNumeric" />
        <GroupingSettings CaseSensitive="false" />
    </telerik:RadGrid>

    I then assign a DataTable to the RadGrid's DataSource property (on Page_Load):

    rgVehicles.DataSource = dsVehicles.Tables[0];
    rgVehicles.DataBind();

    Filtering is completely disabled when I run the website and view this RadGrid. Your documentation states:

    The built-in filtering feature is not supported when you bind the grid by explicitly calling DataBind().

    My question is, how do I enable filtering then? Bare in mind AutoGenerateColumns is set to True, meaning when I call a Stored Procedure and populate a DataSet, I won't always know what the columns will be.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 Sep 2010 Link to this post

    Hello Gregory,

    Bind your grid using advanced Data-binding(Using NeedDataSource event).

    Please refer the following documentation
    Advanced Data-binding (using NeedDataSource event).

    C#:
    protected void rgVehicles_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            rgVehicles.DataSource = dsVehicles.Tables[0];
        }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gregory
    Gregory avatar
    47 posts
    Member since:
    Sep 2010

    Posted 20 Sep 2010 Link to this post

    Thank you, that solved the problem. Now it seems that something in the websites design is interfering with the Filter buttons being clickable. Is there something that could cause this off the top of your head?

    EDIT: It was an issue with some DIV tags in the site, the z-index played a role here. Please ignore the above. Thanks again for your help.
Back to Top