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 convert ColIndex into a column name for a GridControl?

Thread ID:

Created:

Updated:

Platform:

Replies:

57464 Mar 5,2007 10:39 AM Mar 6,2007 06:12 AM Windows Forms 4
loading
Tags: GridControl
John H
Asked On March 5, 2007 10:39 AM

Hi,
I have asked this question before for the GGC, but now I need to do it for a GridControl within the PrepareViewStyleInfo event. Do you have any examples? I cant find a TableDescriptor for the GridControl.

Thanks
John

Administrator [Syncfusion]
Replied On March 5, 2007 10:57 AM

Actually to be more specific, how do I convert the RowIndex and ColIndex within the PrepareViewStyleInfo event of a GridControl to the actual row and column indexes of the underlying dataset?

Thanks
John

Administrator [Syncfusion]
Replied On March 5, 2007 11:05 AM

Hi John,

For GridControl:

Call the GetAlphaLabel method to get the column labels in a grid. Here is a code snippet

string strColumnName = GridRangeInfo.GetAlphaLabel(e.ColIndex);

For DataBoundGrid:

Use InternalColumn collection property to get the column name of the grid. Below is a code

string strColumnName = this.gridDataBoundGrid1.Binder.InternalColumns[e.ColIndex].MappingName;

Best Regards,
Haneef

John H
Replied On March 6, 2007 06:04 AM

Hi Haneef,

Sorry Im not sure how this works:
GridRangeInfo.GetAlphaLabel(e.ColIndex);

Is GridRangeInfo a property of the grid? do I need to get the current selection and create a GridRangeInfo for it?
Sorry I think Im being a bit dim today.

Thanks
John

John H
Replied On March 6, 2007 06:12 AM

Hi Haneef,
I found an example, its quite obvious really. :-)

http://www.syncfusion.com/support/evalcenter/viewsource.aspx?&zip_path=115_Header_Text_-_Rows,_Columns_src.zip&lang=csharp&id=115

Basically just use;
gridControl[0, e.ColIndex].Text;

Thanks
John

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.

;