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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Duplicate Entries in Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

49780 Sep 26,2006 06:50 PM UTC Sep 27,2006 03:59 AM UTC WinForms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 26, 2006 06:50 PM UTC

I am using a GridDataBoundGrid, with a DataTable as the DataSource. In the DataTable, i set the primary key field to prevent duplicate entries. Is there a way I can trap the duplicate key exception before it is thrown up to the user?

Administrator [Syncfusion]
Replied On September 27, 2006 03:59 AM UTC

Hi Michael,

Yes. You can handle the CurrentCellErrorMessage event and display your own error message whenever the grids CurrentCell.DisplayWarningText (as a result of some kind of validation error) is called.

private void grid_CurrentCellErrorMessage(object sender, GridCurrentCellErrorMessageEventArgs e)
{
MessageBox.Show(e.Text,"CurrentCell Error",MessageBoxButtons.OKCancel,MessageBoxIcon.Error );
e.Cancel = true;
}

Let me know if you face any issues when implementing the above.

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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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

;