Handle errorstates in DataTable

Hi, my validationfactory provides me a defined table with rows- and columnsproperty "hasErrors". if(ValidationDataDataSet.Tables[0].HasErrors == true) { errorRowArray = ValidationDataDataSet.Tables[0].GetErrors(); errorColumnArray = errorRowArray[0].GetColumnsInError(); } Is it possible to highlight the cells with errorstate == true (automatically)in griddataboundgrid ? Because it's absolutly complicated to manage errorcells and mark them in the GDBG. greetings markus

1 Reply

AD Administrator Syncfusion Team August 14, 2003 01:38 PM UTC

You will have to handle an event, and in your handler, given a row and column, determine whether that row and column are in error or not. A couple of events you could use for this include PrepareViewStyleInfo or Model.QueryCellInfo.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if(e.ColIndex > 0 && e.RowIndex > 0)
	{
		if( e_RowIndex_and_e_ColIndex_in_error )
			e.Style.BackColor = Color.Red;
	}
}
You may have to do some extra work as your error provider does not expose a method that returns whether a particular row and column is in error, and this is teh information you need to use these events.

Loader.
Up arrow icon