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

Column reorder

5 Answers 223 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Hans asked on 24 Mar 2011, 08:54 PM
Hi !

I have a datasource bound to rad datagrid. But the column order is not what I want.
How I cand give them the index that I want. ?

Hans

5 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 24 Mar 2011, 10:34 PM
Hello,

There are 2 possible ways to do this.
1: You set
this.radGridView1.AugoGenerateColumns = false;
and create the columns manually in the order that you want, or...

2: Use the move method of the collumns collection to modify the position
this.radGridView1.Columns.Move(0, 3);

Hope that helps
Richard
0
Josh
Top achievements
Rank 1
answered on 29 Mar 2011, 03:00 AM
Hey Richard,

I'm looking for the same functionality and the .Move method is not working for me. I'm creating radgridviews dynamically in code at runtime and they are on dynamic radpageviewpages (also created dynamically at runtime), in case that has anything to do with .move not working.

So, normally with a standard ms datagrid I use .Columns("column").DisplayIndex = 0 (or whatever index I need), in order to set up a gridview that has autogencolumns = false, however I do not see that property on the radgridview. Is there something that's going right over my head?

Thanks buddy!
0
Richard Slade
Top achievements
Rank 2
answered on 29 Mar 2011, 09:46 AM
Hi,

.Move would be the method to use to move a column from one index to another, though I haven't been able to replicate your issue. Are you able to post  small sample to demonstrate your issue and I'll take a look at it for you
Thanks
Richard
0
Josh
Top achievements
Rank 1
answered on 29 Mar 2011, 06:18 PM
Hi Richard,

Sorry, I'll just chalk that up to too many late nights in a row. .Move is definitely working. I was, uh, trying to move a hidden column lol. When using it on the correct columns it works perfectly!
0
Richard Slade
Top achievements
Rank 2
answered on 29 Mar 2011, 10:33 PM
No problem Josh. I know how the late nights can be!
Glad that you have it all sorted.
Regards,
Richard
Tags
GridView
Asked by
Hans
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Josh
Top achievements
Rank 1
Share this question
or