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

[Solved] AutoGenerateColumns ordering

4 Answers 198 Views
GridView
This is a migrated thread and some comments may be shown as answers.
superold
Top achievements
Rank 1
superold asked on 02 Aug 2007, 05:03 PM
Hi,

I wonder how I could reorder columns that have been auto generated.
/ jorge

4 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 03 Aug 2007, 08:18 AM
Hi Jorge, you can use Move function of grid Columns collection.

Reorder columns using column index:
radGridView1.Columns.Move(2, 3); 


Reorder columns using column instance and insert position:
radGridView1.Columns.Move(radGridView1.Columns["City"], 
    radGridView1.Columns["Address"], InsertPosition.Before); 

I hope this helpful.

Regards,
Julian Benkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
superold
Top achievements
Rank 1
answered on 03 Aug 2007, 02:11 PM
Perfect.
thanks
/ j
0
superold
Top achievements
Rank 1
answered on 06 Aug 2007, 02:02 PM
Well, sort of perfect.

I tried to SuspendLayout and ResumeLayout on the grid but I had to set the Visibility of the grid instead to have an OK performance, since the columns are visually moved and removed.

Also when some of the columns are hidden I do not know how to reset the horizontal scrollbar to reflect the new width of the grid.

Thanks,
/ jorge

0
Dwight
Telerik team
answered on 06 Aug 2007, 04:14 PM
Hello j0rge,

Instead of using SuspendLayout and ResumeLayout, it is better to use:
 
(radGridView1.GridElement as GridTableElement).BeginUpdate(); 
 
// your code goes here 
 
(radGridView1.GridElement as GridTableElement).BeginUpdate(); 
 

The horizontal scroll should automatically resize. There is no need to take care of it.

 
Regards,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
superold
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
superold
Top achievements
Rank 1
Dwight
Telerik team
Share this question
or