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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Determining DataTable column name associated with cell in GDBG

Thread ID:





27227 Apr 7,2005 08:40 PM UTC Apr 21,2008 06:59 PM UTC WinForms 4
Tags: GridControl
Lori S. Pearsall
Asked On April 7, 2005 08:40 PM UTC

What is the easiest way to determine the name of the underlying DataTable column of the current cell? The following works on grids where one record takes up a single row, but not when a single record spans two rows in the grid: int intCurrentCol = grid.CurrentCell.ColIndex; grid.GridBoundColumns[intCurrentCol].MappingName

Administrator [Syncfusion]
Replied On April 7, 2005 10:37 PM UTC

Try this code.
string name;
int rowIndex = this.gridDataBoundGrid1.CurrentCell.RowIndex;
int colIndex = this.gridDataBoundGrid1.CurrentCell.ColIndex;
GridBoundRecordState rs = gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(rowIndex);
GridHierarchyLevel ghl = gridDataBoundGrid1.Binder.GetHierarchyLevel(rs.LevelIndex)  as GridHierarchyLevel;
int field = this.gridDataBoundGrid1.Binder.ColIndexToField(colIndex);

if(ghl.RowCountPerRecord == 1)
	name = ghl.GridBoundColumns[field].MappingName;
	field = ghl.RowFieldToField(rs.RowIndexInRecord, field);
	name = ghl.GridBoundColumns[field].MappingName;

Lori S. Pearsall
Replied On April 7, 2005 10:51 PM UTC

Thanks Clay - works perfectly!

Ashes Mukherjee
Replied On April 20, 2008 05:57 PM UTC

Have implemented a hierarchical griddataboundgrid. (attached sample)

The following is not working:

Have tried to hide columns that are in child tables (not at the top level and not in the relation), did not work.

Additionally, need to overwrite cell contents of columns that are in the parent/child relation. (Note: only need to overwrite on display, not modify underlying datasource)

Attempted to overwrite content by handling Model.QueryCellInfo, but this is causing relation and hierarchy layout to fail.

Appreciate prompt assistance as project is on critical path.



Ashes Mukherjee
Replied On April 21, 2008 06:59 PM UTC

Please ignore the previous question. We found the solution.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon