
Syncfusion Feedback

Implementing form-level validation using a GGC

Thread ID:





51475 Nov 7,2006 03:06 AM UTC Nov 8,2006 10:08 AM UTC WinForms 1
Tags: Grouping
Michael Lorenz
Asked On November 7, 2006 03:06 AM UTC


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?

Michael Lorenz

Administrator [Syncfusion]
Replied On 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.

Issue 2: Find the RowIndex of the record.

Please refer to below Evalution Center link(=>GroupingGrid category) for more details.

Best Regards,




Please sign in to access our forum

