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

[Solved] Column Reordering

5 Answers 156 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jon Bergquist
Top achievements
Rank 1
Jon Bergquist asked on 11 Mar 2009, 05:42 PM
Hi - is it possible to programatically reorder columns for the Q1 version of the grid?  I'm assuming the user can drag and reorder columns but I need to do it in code. 

Thanks

Jon

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Mar 2009, 04:50 PM
Hi Jon,

Here is an example:

RadGridView1.ItemsControl.ReorderColumns(1, 3);

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jon Bergquist
Top achievements
Rank 1
answered on 12 Mar 2009, 10:51 PM
Thanks.  Is there a way to just set the Column order without using an old and new index?  The reason is that I need to rearrange every column but when I do that all of my initial columns get out of order once I use the Reorder method.  In my example I have column headers for each day of the week which should start with todays date.  As an example, today (3/12) the grid headers would appear as Thu,Fri,Sat,Sun,Mon,Tue,Wed.  I've tried a few different ways to work this out but its proving a bit difficult.

Thanks 
0
Milan
Telerik team
answered on 13 Mar 2009, 10:32 AM
Hello Jon Bergquist,

I have created an extension method that allows you to specify the right order of columns and it will rearrange the columns automatically.
Currently the method uses the UniqueName property of GridViewDataColumn but it can be modified if such scenario is not possible.
I have attached a sample application that demonstrates how you can use the method.

You could also try defining the columns manually before RadGridView is databound, that way you will not have to reorder the columns afterwards.

Best wishes,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Inquisitor Jax
Top achievements
Rank 1
answered on 01 Sep 2009, 09:32 AM
It seems that the ReorderColumns method has been removed.

Is there a replacement API, or am I just missing something?

0
Vlad
Telerik team
answered on 01 Sep 2009, 09:38 AM
Hello,

ReorderColumns() method can be used now from GridViewDataControl (RadGridView) directly.

All the best,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Jon Bergquist
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jon Bergquist
Top achievements
Rank 1
Milan
Telerik team
Inquisitor Jax
Top achievements
Rank 1
Share this question
or