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

Combining Advanced Data-binding and declarative columns?

0 Answers 33 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 02 Feb 2018, 07:47 PM

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?

 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Marcel
Top achievements
Rank 1
Share this question
or