CurrenCell change event in gridGroupingControl
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
SIGN IN To post a reply.
6 Replies
AD
Administrator
Syncfusion Team
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.
PV
Prathima Venkobachar
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
AD
Administrator
Syncfusion Team
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);
}
}
PV
Prathima Venkobachar
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
AD
Administrator
Syncfusion Team
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));
}
}
PV
Prathima Venkobachar
August 2, 2005 12:43 PM UTC
It works fine.
Thanks a lot for ur G8 help..
Prathima
SIGN IN To post a reply.
- 6 Replies
- 2 Participants
-
PV Prathima Venkobachar
- Aug 2, 2005 08:38 AM UTC
- Aug 2, 2005 12:43 PM UTC