Hi,
Since I don't want to have new row added automatically, I called "e.Cancel=true" for EndEditCalled Action in CurrentRecordContextChange(). But after I do this, other cells cannot be selected except the cell in current record.
I tried calling method CurrentCell.Deactivate(), CurrentCell.EndEdit() and CurrentRecord.EndEdit(), but it results in a looping.. the cause may be because of EndEditCalled action is triggered for these methods.
Any idea for how can other cell be selected after e.Cancel=true is called for EndEditCalled action?
Thanks!
RA
Rajagopal
Syncfusion Team
May 16, 2007 09:45 PM UTC
Hi Person,
If you dont want to have add new records in grid, use the below property settings.
this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;
this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordAfterDetails = false;
Let us know if this is not what you needed.
Regards,
Rajagopal
PE
Person
May 17, 2007 08:42 AM UTC
Hi Rajagopal,
Thanks for reply.
That's not what I want. What I need to solve is if a cell is edited, no matter pressing Enter key or mouse click on anywhere, a new row will be added in the grid.
I search in forum and find the way to use CurrentRecordContextChange event and set e.Cancel=true, then no more new row is added. However, apart from the editing row field, no other rows and their cell can be selected.
Could you help on this.
Thanks again.
RA
Rajagopal
Syncfusion Team
May 17, 2007 10:37 PM UTC
Hi Person,
Please try the modified code below in the CurrentRecordContextChange event of the grid.
void gridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if (e.Action == CurrentRecordAction.EndEditCalled)
{
e.Cancel = true;
e.Record.GetRecord().CancelEdit();
}
}
Let us know if this helps.
Regards,
Rajagopal
PE
Person
May 18, 2007 03:07 AM UTC
Hi Rajagopal,
I am sorry to tell that the way you provided is just discarding the changes on the cell as well as a new row is added to the grid again.
Actually, is it possible to turn off the new line adding? It seems that a new line will be automatically added to the grid after any editing on the cell record.
Thanks again.
HA
haneefm
Syncfusion Team
May 18, 2007 08:35 PM UTC
Hi Person,
Try checking the addnewrow in a CurrentRecordContextChange event and set e.Cancel to true for EndEditCalled action. Below is a code snippet.
private void gridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if (e.Record is GridAddNewRecord && e.Action == CurrentRecordAction.EndEditCalled)
{
e.Cancel = true;
e.Record.GetRecord().CancelEdit();
}
}
Best regards,
Haneef
PE
Person
May 25, 2007 06:41 AM UTC
Hi Haneef,
Thanks for reply.
Your suggestion will result in a new row added.
(i.e. I add a new row, and edit a cell in that row, after edit finish and clicking on other cell, the editing row is fine, but.. another new row is added in the grid which I don't want..)
Do you have any idea on this?
HA
haneefm
Syncfusion Team
May 25, 2007 05:56 PM UTC
Hi Person,
Thank you for your update.
Is it possible for you to upload us a minimal sample to reproduce the issue here? This will help us to analyse the issue further.
Best regards,
Haneef