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

Set and save the columns order and RadGrid

1 Answer 303 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pierre
Top achievements
Rank 1
Pierre asked on 14 Jan 2013, 11:56 AM
hello,

I have a radgrid that contains a MasterTable and a DetailTable. The problem is that I can’t set the orders of the columns in the Mastertable and the DetalTable.
Is it possible to set and save the orders myself instead having the default orders?

Regards, 

1 Answer, 1 is accepted

Sort by
0
MasterChiefMasterChef
Top achievements
Rank 2
answered on 16 Jan 2013, 04:58 PM
Hi Pierre,

There are several possible ways to achieve the requested functionality:

  • Using OrderIndex:
protected void RadGrid1_PreRender(object sender, EventArgs e)
 
{
 
    if (!IsPostBack)
 
    {
 
        GridColumn column = RadGrid1.MasterTableView.GetColumnSafe("DragDropColumn") as GridColumn;
 
        column.OrderIndex = RadGrid1.MasterTableView.RenderColumns.Length;
 
        RadGrid1.MasterTableView.Rebind();
 
    }
 
}

  • Swap command on the server:
http://www.telerik.com/help/aspnet-ajax/overload_telerik_web_ui_gridtableview_swapcolumns.html

  • Swap command on the client:
  • Reorder on the client:

To understand the difference between reordering and swapping columns on client, please check out the following topic:
http://www.telerik.com/help/aspnet-ajax/grid-reordering-columns.html


I hope this will prove helpful. Please choose the approach most suitable to your specific requirements and let me know about the result.

Good luck,
Bart
Tags
Grid
Asked by
Pierre
Top achievements
Rank 1
Answers by
MasterChiefMasterChef
Top achievements
Rank 2
Share this question
or