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
close icon

Implementing form-level validation using a GGC

Hi,

My question still has to do with validation. I've looked through all of the examples I could find, and nothing matches what I'm looking for: when the user is done with the form (and the GGC), the user will click on a Save button. When that happens, I need to loop through the visible data in the grid, performing various cross-checks, and highlight all cells that are in error. Here's a code snippet of what I have so far:

foreach( Syncfusion.Grouping.Record groupRecord in this.TableModel.Table.FilteredRecords ) {
DataRowView drv = (DataRowView)groupRecord.GetData();
myRow row = (myRow)drv.Row;
if( this.currentView == ViewToBeTested ) {
if( myRow.IsmyFieldNull() || myRow.myField == 0 ) {
// Error condition here
}
}
}

So, I'm looping through the filtered records, since I *am* using a filter. I cast the grouping record to my underlying data so I can check the fields I'm interested in, and I find an error. Now, how do I mark the corresponding cell in the *grid* as having an error? Specifically: how do I figure out the row and column indices for the cell, and then how do I set the ErrorMessage for that cell so that it's highlighted and has the error icon? Is this even the correct approach, or is there a better way?

Thanks,
Michael Lorenz

1 Reply

AD Administrator Syncfusion Team November 8, 2006 10:08 AM UTC

Hi Michael,

My apologies for the delayed response.

Issue 1 : Draw the Error Icon in a cell.

The TestErrorProvider browser sample shows you how to draw an ErrorProvider-like icon for cell using the IconPaint class. Also refer to the below forum thread for customizing the ErrorIcon.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=46953

Issue 2: Find the RowIndex of the record.

Please refer to below Evalution Center link(=>GroupingGrid category) for more details.
http://www.syncfusion.com/support/evalcenter/default.aspx?cNode=5

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon