Ok, I am looking at all the examples and not seeing how I can maintain the sort with my grid. I use an obejct hierarchy not some DataSourceID with SQL in the page :(
How do I get the sort to work on the CLIENT side with the data already in the GRID?
| <telerik:RadGrid ID="RadGrid1" |
| AllowMultiRowSelection="True" |
| AllowSorting="True" |
| AllowPaging="False" |
| Skin="Vista" |
| Width="95%" |
| ShowStatusBar="true" |
| AutoGenerateColumns="False" GroupingEnabled="true" |
| ShowHeader="true" GridLines="Horizontal" |
| AlternatingItemStyle-BackColor="#ffffff" |
| OnSortCommand="RadGrid1_SortCommand" |
| runat="server"> |
<
Columns>
<telerik:GridBoundColumn SortExpression="ROWNUM" HeaderText="Priority" HeaderButtonType="TextButton" HeaderStyle-Width="50" ItemStyle-Width="50" DataField="ROWNUM" SortAscImageUrl="~/images/desc.gif" SortDescImageUrl="~/images/asc.gif"/>
</Columns>
| private void BindGrid() |
| { |
| CustomerListBLL customerList = new CustomerListBLL(); |
| DataTable dtCustomers = new DataTable(); |
| dtPricingQueue = customerList.GetCustomers; |
| RadGrid1.DataSource = dtCustomers ; |
| RadGrid1.DataBind(); |
| } |
How does this rebind the data? I thought the Grid held the data in View State? I DO NOT want to REBIND the data, the sort should be done on the client side.
| protected void RadGrid1_SortCommand(object source, Telerik.Web.UI.GridSortCommandEventArgs e) |
| { |
| if (!e.Item.OwnerTableView.SortExpressions.ContainsExpression(e.SortExpression)) |
| { |
| GridSortExpression sortExpr = new GridSortExpression(); |
| sortExpr.FieldName = e.SortExpression; |
| sortExpr.SortOrder = GridSortOrder.Ascending; |
| e.Item.OwnerTableView.SortExpressions.AddSortExpression(sortExpr); |
| } |
| //BindGrid(); I DO NOT WANT TO DO THIS |
| } |
How do I get the sort to work on the CLIENT side with the data already in the GRID?