Combining Advanced Data-binding and declarative columns?

1 posts, 0 answers
  1. Marcel
    Marcel avatar
    1 posts
    Member since:
    Jan 2018

    Posted 02 Feb 2018 Link to this post

    I am using advanced data binding to filter, sort, and page a Telerik RadGrid. Because the DataSource is set on the NeedDataSource event, the columns and filters are generated based off the structure of the DataSource. Is there a way for the DataSource's select statement to know what columns to put the data in if I explicitly create the columns in the aspx? Right now the select adds the columns in addition to the existing ones.

    aspx:

    <telerik:RadGrid
        ID="RadGrid1"
        runat="server"
        AllowCustomPaging="True"
        AllowFilteringByColumn="True"
        AllowPaging="True"
        AllowSorting="True"
        OnNeedDataSource="RadGrid1_NeedDataSource"
        EnableLinqExpressions="False">
    </telerik:RadGrid>

     

    aspx.cs:

    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) {
        //RadGrid1Select is a functioning filter/sort/page
        Select methodRadGridIsows.DataSource = RadGrid1Select();
        RadGridIsows.VirtualItemCount = count;
    }

     

    I am able to customize column filters by putting them directly in the aspx, however this causes there to be a repeat column because the DataSource columns will bind to it anyways. If there is no way to access the RadGrid columns on databinding, is there a way to associate certain columns in the aspx with the DataSource's DataTable when binding?

     

Back to Top