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.

How to make my ''X'' column always be as first column

Thread ID:

Created:

Updated:

Platform:

Replies:

48259 Aug 23,2006 10:04 AM Aug 24,2006 01:19 AM Windows Forms 1
loading
Tags: GridControl
Vijaya Kumar Reddy
Asked On August 23, 2006 10:04 AM

Hi,

I want to make sure my ''X'' column should be always available at the first position in Grid Grouping Control. The first position of this column should NOT be allowed to Change or occupied by any other column.

Thanks for the help in advance.

Regards
Vijay

Administrator [Syncfusion]
Replied On August 24, 2006 01:19 AM

Hi Vijay,

Use the TableDescriptor.Columns property to manages column descriptors in the grid. It allows you to add and remove columns, moves column at specific position. Below the code snippet.

//Form Load event.
int index = this.gridGroupingControl1.TableDescriptor.NameToField("ColumnName");
this.gridGroupingControl1.TableDescriptor.Columns.Move(index,0);

this.gridGroupingControl1.TableDescriptor.Columns.Changed +=new Syncfusion.Collections.ListPropertyChangedEventHandler(Columns_Changed);

private void Columns_Changed(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
if( e.Action == Syncfusion.Collections.ListPropertyChangedType.Move )
{
GridColumnDescriptorCollection columns = sender as GridColumnDescriptorCollection;

if( columns != null && columns[0].Name != "ComboList")
{
columns.Changed -=new Syncfusion.Collections.ListPropertyChangedEventHandler(Columns_Changed);

GridColumnDescriptor col = columns[ "ColumnName" ];
columns.Remove("ColumnName");
columns.Insert(0,col);

columns.Changed +=new Syncfusion.Collections.ListPropertyChangedEventHandler(Columns_Changed);
}
}
}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/Columns_e2b32cee.zip

Let me know if this is not what you wanted.
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.

;