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.

CurrenCell change event in gridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

32483 Aug 2,2005 04:38 AM Aug 2,2005 08:43 AM Windows Forms 6
loading
Tags: GridControl
Prathima Venkobachar
Asked On August 2, 2005 04:38 AM

Hi, I want to capture the cell value whenever there is a change in the cell value. which event is better to use either: this.gridgroupingControl.TableControlCurrentCellChanged or this.gridgroupingControl.TableControlCurrentCellChanging. Thanks, prathima

Administrator [Syncfusion]
Replied On August 2, 2005 05:11 AM

The Changing event is only raised once (on the first change by your user to the cell). It will not be raised again until teh user leaves the cell, then returns to teh cell, and starts to make another change to teh cell. If you want to catch evey (intermediate) change, then the TableControlCurrentCellChanged event is better.

Prathima Venkobachar
Replied On August 2, 2005 05:30 AM

Thanks, How can I get the current cell changed value..? If the current cell is "price", I want to set this value to another column in the grid. How can I do this..? Thanks, Prathima

Administrator [Syncfusion]
Replied On August 2, 2005 06:02 AM

To do what you described, I would suggest using TableControlCurrentCellValidating. This is hit once as your user leaves the cell. This code will then copy teh value in ParentName to the ParentDec column.
private void gridGroupingControl1_TableControlCurrentCellValidating(object sender, GridTableControlCancelEventArgs e)
{
	GridCurrentCell cc = e.TableControl.CurrentCell;
	GridTableCellStyleInfo style = e.TableControl.Model[cc.RowIndex, cc.ColIndex] as GridTableCellStyleInfo;
	if (style.TableCellIdentity.Column != null &&
		style.TableCellIdentity.Column.MappingName == "ParentName" &&
		(style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell ||
		style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell))
	{
		string newvalue = cc.Renderer.ControlText;
		GridRecordRow rr = style.TableCellIdentity.DisplayElement as GridRecordRow;

		rr.ParentRecord.SetValue("ParentDec", newvalue);
	}
}

Prathima Venkobachar
Replied On August 2, 2005 07:30 AM

I want to do this as and when the user changes the cell value. It is not necessary the user leaves the columns. Is it better for me to use TableControlcellChanging event. Thanks, Prathima

Administrator [Syncfusion]
Replied On August 2, 2005 08:26 AM

TableControlCurrentCellChanged is where you can catch each change by your user. You will also have to make sure the row id redrawn so you change to the other column is displayed imeddiately.
private void gridGroupingControl1_TableControlCurrentCellChanged(object sender, GridTableControlEventArgs e)
{
	GridCurrentCell cc = e.TableControl.CurrentCell;
	GridTableCellStyleInfo style = e.TableControl.Model[cc.RowIndex, cc.ColIndex] as GridTableCellStyleInfo;
	if (style.TableCellIdentity.Column != null &&
		style.TableCellIdentity.Column.MappingName == "ParentName" &&
		(style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell ||
		style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell))
	{
		string newvalue = cc.Renderer.ControlText;
		GridRecordRow rr = style.TableCellIdentity.DisplayElement as GridRecordRow;

		rr.ParentRecord.SetValue("ParentDec", newvalue);
		e.TableControl.RefreshRange(GridRangeInfo.Row(cc.RowIndex));
	}
}

Prathima Venkobachar
Replied On August 2, 2005 08:43 AM

It works fine. Thanks a lot for ur G8 help.. Prathima

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.

;