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.

Databoundgrid - constraintexception

Thread ID:

Created:

Updated:

Platform:

Replies:

2363 Jan 13,2003 09:26 AM Jan 13,2003 05:37 PM Windows Forms 1
loading
Tags: GridControl
Pascal Couture
Asked On January 13, 2003 09:26 AM

I have a databound grid to a datatable. The grid display only one column. It display's a combobox to select an item. The selected item is the key to the bound datatable. If the user select's an item that is already in the list and moves to another row or control, vb pop'up an error messagebox. What event can I use to trap this message and display something else?

Administrator [Syncfusion]
Replied On January 13, 2003 05:37 PM

Try handling the CurrentCellValidating event, and checking the value there, and setting e.Canceled = True if the action should be cancelled. You can set the currentcell's ErrorMessage to display a particular message.
private void gridDataBoundGrid2_CurrentCellValidating(object sender, CancelEventArgs e)
{
	GridCurrentCell cc = this.gridDataBoundGrid2.CurrentCell;
	if(cc.ColIndex == 7)
	{
		string newValue = cc.Renderer.ControlText;
		try
		{
			double d = double.Parse(newValue);
		}
		catch
		{
			cc.ErrorMessage = "Not a double...";
			e.Cancel = true;
		}
	}
}

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.

;