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

CellButtonClick consuming my exceptions?

In the CellButtonClicked event, if I throw an exception it does not bubble up, but rather the grid code consumes it (but does write it out to the debugger output). Is this by design? I am using version 3.0.1 of the GridDataBoundGrid.

1 Reply

AD Administrator Syncfusion Team June 9, 2005 12:35 PM

This is by design. Here the code.
public bool RaiseCellButtonClicked(int rowIndex, int colIndex, int index, GridCellButton button)
{
	TraceUtil.TraceCurrentMethodInfoIf(Switches.CurrentCell.TraceVerbose, PaneDesc, rowIndex, colIndex, index, button);
	GridCellButtonClickedEventArgs e = new GridCellButtonClickedEventArgs(rowIndex, colIndex, index, button);
	try
	{
		OnCellButtonClicked(e);
	}
	catch (Exception ex)
	{
		TraceUtil.TraceExceptionCatched(ex);
		if (!ExceptionManager.RaiseExceptionCatched(this, ex))
			throw ex;
		e.Cancel = true;
	}
	return !e.Cancel;
}
This code also shows how you can make the grid rethrow the exception. It uses the ExceptionManager class in Shared. Syncfusion.Windows.Forms.ExceptionManager that has static members that you can use to control how the grid handles exceptions. For example, to suspend the grid''''s error handling, try Syncfusion.Windows.Forms.ExceptionManager.SuspendCatchExceptions = true; You can also hook an event (Syncfusion.Windows.Forms.ExceptionManager.ExceptionCatched) to get any exception thrown, and handle them yourself.

Loader.
Live Chat Icon For mobile
Up arrow icon