Set and save the columns order and RadGrid

2 posts, 0 answers
  1. Pierre
    Pierre avatar
    7 posts
    Member since:
    Jun 2010

    Posted 14 Jan 2013 Link to this post


    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?

  2. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 16 Jan 2013 Link to this post

    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;

    • Swap command on the server:

    • 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:

    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,
Back to Top