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

runtime display of the ( ! ) in a ggc cell if validating fails

how do i perform the above when a validating process failed in TableControlCurrentCellValidating event? thanks

7 Replies

AD Administrator Syncfusion Team April 14, 2005 07:14 PM UTC

Try getting the CurrentRecordProperty with Table.CurrentRecordManager.Properties[fieldName]. Then you can set CurrentRecordProperty.Exception on that field. It should show up then in red with a error marker. Stefan >how do i perform the above when a validating process failed in TableControlCurrentCellValidating event? > >thanks

AD Administrator Syncfusion Team April 16, 2005 10:30 AM UTC

it worked. thanks.

EW Eric Weber September 19, 2006 11:38 PM UTC

I''m confused...

Please see the attached sample app. I''m trying to set the (!) icon in the Shares column''s current cell after a user edits the cell, but I can''t get the error icon to appear!

If, however, I set the error to appear in another column (the Text column) when the user edits the Shares data, then the error does appear in the other column. (and then it only appears in the Shares cell when you click back into the shares cell)

Try commenting/uncommenting the following line...

e.TableControl.Table.CurrentRecordManager.Properties["Text"].Exception = new Exception("error");

Thanks in advance for your help!



AD Administrator Syncfusion Team September 20, 2006 01:18 PM UTC

Hi Eric,

Sorry for the inconvenience caused.

We are looking into this issue and get back to you very soon.

Thanks for your patience.


EW Eric Weber September 20, 2006 04:42 PM UTC

After thinking about it some, it seems like the error icon won''t be displayed until the cell is not it "edit mode". That is why the Text column''s error icon shows up (because it is not being edited). Then when you click in the Text column cell, the Shares column error icon shows up because now it is not being edited.

Here''s what I''m trying to do...

1. user edits cell
2. user leaves cell
3. display error icon in cell (under certain conditions), but allow user to move on to other cells.
4. Don''t display a message box error if cell doesn''t validate (only show error icon).



EW Eric Weber September 20, 2006 06:26 PM UTC

Don''t spend alot of time trying to figure out what''s going on. I coded up a work around which suits my needs perfectly (see attached). One of the things I liked about the exception icon, is that it appears right justified, and the text moves to the left. Any tips on how to achieve that? When running my sample app, you''ll need to change the icon path.




AD Administrator Syncfusion Team September 21, 2006 04:41 AM UTC

Hi Eric,

Sorry for the delay in getting back to you.

You could get this working by handling the TableControlCellDrawn event and draw image in the error cell. Below is a code snippet:

private void grid_TableControlCellDrawn(object sender, GridTableControlDrawCellEventArgs e)
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
if (style.TableCellIdentity.Column != null && e.Inner.Style.CellType == "Currency")

if (e.TableControl.Table.CurrentRecordManager.Properties[style.TableCellIdentity.Column.Name].IsError)
e.Inner.Cancel = true;

// Highlight error column
Brush br = new SolidBrush(Color.FromArgb(64, Color.Red));
e.Inner.Graphics.FillRectangle(br, e.Inner.Bounds);

Rectangle iconBounds = Rectangle.FromLTRB(e.Inner.Bounds.Right - 15, e.Inner.Bounds.Top, e.Inner.Bounds.Right, e.Inner.Bounds.Bottom);
iconBounds.Offset(-2, 0);
IconPainter.PaintIcon(e.Inner.Graphics, iconBounds, Point.Empty, "SFERROR.BMP", Color.Red);
{ }

Rectangle rect = e.Inner.Bounds;
rect.Size = new Size(rect.Width - 15, rect.Height);
e.Inner.Renderer.Draw(e.Inner.Graphics, rect, e.Inner.RowIndex, e.Inner.ColIndex, e.Inner.Style);


Modified sample : http://www.syncfusion.com/Support/user/uploads/ModifiedWindowsApplication1_19b48fef.zip

Refer the TestErrorProvider browser sample for drawing the icon in a cell.
[installdrive]\Syncfusion\Essential Studio\\windows\Grid.Grouping.Windows\Samples\TestErrorProvider\cs

Best Regard,

Live Chat Icon For mobile
Up arrow icon