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

Change Column index/display index?

6 Answers 2213 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 11 Apr 2013, 08:15 AM
Hi guys,

Just wandering is is possible to change the grid views Column index's? or Possible to change the display, heck even both.

Typically in Winforms i use  the code below.

Hoping this is just a syntax lack of knowledge for Telerik controls.

Many thanks in advanced guys!
dgv_Pareto.Columns["Pg"].DisplayIndex = 0;
dgv_Pareto.Columns["Part"].DisplayIndex = 1;

6 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 15 Apr 2013, 02:03 PM
Hi Steven,

Thank you for writing.

You can move the columns in RadGridView by using the Move method of the Columns collection:
radGridView1.Columns.Move(radGridView1.Columns["ColumnToMove"], 2);

I hope this helps. 

Kind regards,
Stefan
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
Marc
Top achievements
Rank 1
answered on 05 Sep 2017, 07:55 AM

Hi Stefan,

How i can get the display index of the column?

I need get this for save order columns and replicate after.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Sep 2017, 08:02 AM
Hello Marc, 

Thank you for writing.  

Each column has Index property which indicates the position. However, in order to keep the columns order, it is suitable to use save/load layout. Additional information is available in the following section in the documentation: http://docs.telerik.com/devtools/winforms/gridview/save-and-load-layout/save-and-load-layout

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Aseman
Top achievements
Rank 1
Veteran
answered on 11 Sep 2019, 04:58 AM

Does Column in Rad GridView, have property for setting Column Index?

for Example: 

RadGridView .column[0].Index=2;

 

so How can I Do it?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Sep 2019, 01:55 PM

Hello, Aseman,

The GridViewColumn offers a public Index property indicating the position of the column in the Columns collection of the OwnerTemplate.

int columIndex = this.radGridView1.Columns["ProductName"].Index;

I hope this information helps.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
dina
Top achievements
Rank 1
answered on 06 Oct 2019, 12:52 PM
thanks, it worked for me
Tags
GridView
Asked by
Steven
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Marc
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Aseman
Top achievements
Rank 1
Veteran
dina
Top achievements
Rank 1
Share this question
or