We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

GridControl Column Order

Thread ID:

Created:

Updated:

Platform:

Replies:

61803 Jun 1,2007 03:26 PM Jun 4,2007 05:27 PM Windows Forms 5
loading
Tags: GridControl
Qingde Shi
Asked On June 1, 2007 03:26 PM

Hi,

How to change Columns order (reposition column) in GridControl?

Thanks.

Q

haneefm [Syncfusion]
Replied On June 1, 2007 04:04 PM

Hi Q,

You can apply the this.grid.Model.Cols.MoveRange method to place you columns.To place the first column to the second column, test:

this.gridControl1.Cols.MoveRange(1, 2);

//or

You can allow the user to use the default drag column support by setting AllowDragSelectedCols to true and enable DragColumnHeader flag in the Controller option. Please try this and let me know if this helps.

this.grid.AllowDragSelectedCols = true;
this.grid.ControllerOptions |= GridControllerOptions.DragColumnHeader;

Best regards,
Haneef

Qingde Shi
Replied On June 1, 2007 04:28 PM

Thanks.

What if you only know the column name? I can not find the map from Column Name to Column Index or Index to Name.



>Hi Q,

You can apply the this.grid.Model.Cols.MoveRange method to place you columns.To place the first column to the second column, test:

this.gridControl1.Cols.MoveRange(1, 2);

//or

You can allow the user to use the default drag column support by setting AllowDragSelectedCols to true and enable DragColumnHeader flag in the Controller option. Please try this and let me know if this helps.

this.grid.AllowDragSelectedCols = true;
this.grid.ControllerOptions |= GridControllerOptions.DragColumnHeader;

Best regards,
Haneef

haneefm [Syncfusion]
Replied On June 1, 2007 05:15 PM

Hi Q,

You can find the colIndex by column name using the NameToColIndex method and find the column name by colindex using the ColIndexField method. Here is a code snippet that show this.

int colIndex = grid.Binder.NameToColIndex("ColumnName");

int field = grid.Binder.ColIndexToField(col);
string name = grid.Binder.InternalColumns[field].Name;

Best regards,
Haneef

Qingde Shi
Replied On June 1, 2007 08:39 PM

Hi Haneef ,

Thanks for your help. However, I can not find the Binder property in the GridControl. I am using 4.4.

Q


>Hi Q,

You can find the colIndex by column name using the NameToColIndex method and find the column name by colindex using the ColIndexField method. Here is a code snippet that show this.

int colIndex = grid.Binder.NameToColIndex("ColumnName");

int field = grid.Binder.ColIndexToField(col);
string name = grid.Binder.InternalColumns[field].Name;

Best regards,
Haneef

haneefm [Syncfusion]
Replied On June 4, 2007 05:27 PM

Hi Q,

You can use the GridRangeInfo.GetAlphaLabel() method to get label name from the colindex in a grid. Below is a code snippet

[c#]
Console.WriteLine( GridRangeInfo.GetAlphaLabel(1000) );

Best regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;