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. Image for the cookie policy date

Can you help with adding and editing in a GGC please?

Hi there,
How can I prompt a user to save or discard changes to a grid?

If a user adds a record or a user edits a record,
whether by clicking first with a mouse or other way of getting focus, I want to prompt them to save or discard the changes before they can do anything else like clicking another row or moving the pointer out of the grid. Do you have a sample along these lines?

Thanks again for your help,
Dimitri

2 Replies

AD Administrator Syncfusion Team February 13, 2007 12:41 AM UTC

Hi Dimitri,

Try this code in TableControlCurrentCellMoving event of the grid.

private void gridGroupingControl1_TableControlCurrentCellMoving(object sender, GridTableControlCurrentCellMovingEventArgs e)
{
if( e.TableControl.CurrentCell.IsModified )
{
DialogResult result = MessageBox.Show("Do you want to save the cellchange","Header",MessageBoxButtons.OKCancel) ;
if( result == DialogResult.OK )
this.gridGroupingControl1.Table.EndEdit();
else
this.gridGroupingControl1.Table.CancelEdit();
}
}

Here is a sample:
gridFindDialog.zip

Best regards,
Haneef


AD Administrator Syncfusion Team February 14, 2007 09:19 PM UTC

Thanks Haneef; I think I can use that -

a related question. How can I add/enable dropdowns on the Add New Record Row? I am toggling using:

this.myGGC.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = true;

etc..

but I'd like to have selected cells in that row have pre-populated dropdowns for cell values that are not user input or that have a list of choices (like an ID)

Thanks again,




>Hi Dimitri,

Try this code in TableControlCurrentCellMoving event of the grid.

private void gridGroupingControl1_TableControlCurrentCellMoving(object sender, GridTableControlCurrentCellMovingEventArgs e)
{
if( e.TableControl.CurrentCell.IsModified )
{
DialogResult result = MessageBox.Show("Do you want to save the cellchange","Header",MessageBoxButtons.OKCancel) ;
if( result == DialogResult.OK )
this.gridGroupingControl1.Table.EndEdit();
else
this.gridGroupingControl1.Table.CancelEdit();
}
}

Here is a sample:
gridFindDialog.zip

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon