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.
Syncfusion Feedback

CurrenCell change event in gridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 09:11 AM UTC

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 09:30 AM UTC

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 10:02 AM UTC

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 11:30 AM UTC

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 12:26 PM UTC

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 12:43 PM UTC

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.

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

;