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

Set Column Order

6 Answers 215 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Axel
Top achievements
Rank 1
Axel asked on 19 Jul 2011, 10:21 AM
Hello,

How
do I set the column order in C #. Net by code
so:

Column1
, column2, column3
to
Column2, column1, column3

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Jul 2011, 05:36 AM
Hello Sascha,

I am not quite sure about your requirement. I suppose you want to swap the columns. If that is the requirement, you can swap the columns using "RadGrid1.MasterTableView.SwapColumns("ColumnUniqueName1","ColumnUniqueName2");". Check the following help documentation which explains more about this.
Reordering Columns.

Thanks,
Princy.
0
Axel
Top achievements
Rank 1
answered on 20 Jul 2011, 08:13 AM
Hello Princy

The page:
http://www.telerik.com/help/aspnet-ajax/grid-reordering-columns.html
I already knew.
Thank you anyway.

Was thinking more of:
Order index read and set

http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-setting-order-index-property.aspx

But there is not MasterTableView.columns ?????

Greetings Sascha
0
Princy
Top achievements
Rank 2
answered on 20 Jul 2011, 08:36 AM
Hello Sascha,

How you tried accessing the columns> I cannot find any issue related to getting the columns.
C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
 {
     RadGrid1.MasterTableView.Columns[3].OrderIndex=5;//able to get the column
  }

Thanks,
Princy.
0
Axel
Top achievements
Rank 1
answered on 20 Jul 2011, 12:10 PM
Hello Princy,
at:

  radGridView1.MasterTableView.Columns[3].OrderIndex = 5;

I get the following error

Telerik.WinControls.UI.RadGridView contains no definition for "Mastertableview"

Thanks,
Sascha.

0
Rahul Masurekar
Top achievements
Rank 1
answered on 14 Sep 2011, 08:33 AM
Hello Princy,

Can you please share one working example here.
Somehow its not working for me.
0
Stefan
Telerik team
answered on 16 Sep 2011, 02:43 PM
Hello Rahul,

Thank you for writing.

The question that Sascha asked concerned RadControls for WinForms and not the ASP.NET AJAX suite. Here are the links to the help sections for both RadControls for WInForms and RadControls for ASP.NET AJAX:

I hope that the provided information addresses your question. Should you have any other questions, do not hesitate to contact us.

Kind regards,
Stefan
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
Tags
Grid
Asked by
Axel
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Axel
Top achievements
Rank 1
Rahul Masurekar
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or