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.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

56264 Feb 12,2007 03:30 PM Feb 14,2007 04:19 PM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 12, 2007 03:30 PM

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

Administrator [Syncfusion]
Replied On February 12, 2007 07:41 PM

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

Administrator [Syncfusion]
Replied On February 14, 2007 04:19 PM

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

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.

;