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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

27484 Apr 13,2005 02:54 PM UTC Sep 21,2006 04:41 AM UTC WinForms 7
loading
Tags: Grouping
Administrator [Syncfusion]
Asked On April 13, 2005 02:54 PM UTC

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

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

Administrator [Syncfusion]
Replied On April 16, 2005 10:30 AM UTC

it worked. thanks.

Eric Weber
Replied On 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!

Eric

WindowsApplication155.zip

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

Regards,
Haneef

Eric Weber
Replied On 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).

Thanks,

Eric

Eric Weber
Replied On 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.

thanks!

eric

WindowsApplication156.zip

Administrator [Syncfusion]
Replied On 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;
Console.WriteLine(style.TableCellIdentity.Column.Name);

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

try
{
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);
}
catch
{ }

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\4.3.0.25\windows\Grid.Grouping.Windows\Samples\TestErrorProvider\cs

Best Regard,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;