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

Multi Column Sorting When Header Click...

1 Answer 572 Views
Grid
This is a migrated thread and some comments may be shown as answers.
raaj
Top achievements
Rank 1
raaj asked on 28 Sep 2010, 11:19 PM
Team,

In my application am generating Datatable at runtime. Then directly binding this Datatable to Radgrid.
My need is I want to apply sorting through code behind on the Dynamically generated columns.
Pls. help on this.

Markup is as below:

<

 

telerik:RadGrid ID="MainGrid2" runat="server" ShowHeader = "true"

 

 

GridLines="Both" OnPreRender="AnswerGenMainGrid1_PreRender" Skin="none"

 

 

OnItemDataBound="MainGrid2_ItemDataBound" EnableEmbeddedSkins = "false" OnItemCreated = "MainGrid2_ItemCreated" >

 

 

 

 

 

</telerik:RadGrid>

Thanks in Advance
r

 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Sep 2010, 06:42 AM
Hello Rajesh,

 I assume that you are binding the grid in PageLoad event, which is Simple data binding technique. If you are using any advanced feature in grid, then a better approach is using "AdvancedData binding" using NeedDataSource event. Set the DataSource in NeedDataSource event and set the AllowSorting property of RadGrid to True. RadGrid fires the NeedDataSource event each time it needs to be bound to a data source. For more information about this can be available here:

Grid / Advanced Data Binding
Advanced Data-binding (using NeedDataSource event)

Thanks,
Princy.
Tags
Grid
Asked by
raaj
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or