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.

CellClick vs QueryCellInfo

Thread ID:

Created:

Updated:

Platform:

Replies:

37056 Nov 15,2005 08:25 AM Nov 15,2005 12:12 PM Windows Forms 5
loading
Tags: GridControl
Babak Keradman
Asked On November 15, 2005 08:25 AM

I am trying to change the text of a label on the form when a user click any cell in a particular column. What is the best way to trigger this event? How can I tell what column the current cell is in?

Administrator [Syncfusion]
Replied On November 15, 2005 08:30 AM

Try handling the grid.CellClick event. e.ColIndex should give you the column index.

Administrator [Syncfusion]
Replied On November 15, 2005 08:44 AM

If you are using a GridDataBoundGrid, you can use grid.Binder.NameToColIndex to test if e.ColIndex has a particular column name. if(grid.Binder.NameToColindex(e.ColIndex) == "TheColumn") { //clicked TheColumn }

Babak Keradman
Replied On November 15, 2005 09:10 AM

I am using a GridGroupingControGrid, I can''t seem to find the property "Binder" ?

Administrator [Syncfusion]
Replied On November 15, 2005 10:20 AM

In a GridGroupingControl, you can try using the TableControlCellClick event.
private void grid_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
{
	GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
	if(style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell)
	{
		string colName = style.TableCellIdentity.Column.Name;
		Console.WriteLine(colName);
	}
}

Babak Keradman
Replied On November 15, 2005 12:12 PM

that worked beautifully!!!

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.

;