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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Validation

Thread ID:

Created:

Updated:

Platform:

Replies:

56452 Feb 15,2007 09:51 AM UTC Feb 19,2007 09:25 PM UTC WinForms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 15, 2007 09:51 AM UTC

Hi,

we have a GGC which is bound to a business object (as datasource). Now I want to handle the validation of the cells by myself.

I thought I can use the TableControlCurrentCellValidating and TableControlCurrentCellValidated events. We use a separate module which is responsible for the validation. Now when a cell is validated I want to store that value in our data model (but I want to store the value by myself and not by the grid) So I thought I have to set the value and then call EndEdit?

It would be great if you can help me with a small sample what I have to do to solve the problems mentioned above?

Cheers,
Chris

Administrator [Syncfusion]
Replied On February 15, 2007 05:47 PM UTC

Hi Chris,

The GridGroupingControl tries to listen to events on the DataSource and automatically tries respond appropriately. Since Datasource raises ListChanged events when you edit a record, the grid should know about these changes and have them reflected inside the grid as the events are raised. If you don't want to store the value in a grid than you can have to maintain the hashtable/IList to store the value in a CurrentCellValidating event and call the CurrentCell.RejectChanges/Table.CancelEdit method to reject the changes in a grid. Please refer the attached sample and let me know if this helps.

Sample : GGCValidIBindingList.zip

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 16, 2007 07:14 AM UTC

Hi Haneef,

thank you very much for your detailed example. But what happens if something goes wrong in the validation (the value is invalid)? In the current example you just set Cancel to "true" and the original value will be used. How can I show an error icon in that cell if the validation fails?

It would be a great help if you could extend your sample?

Thank you very much in advance

Cheers

Administrator [Syncfusion]
Replied On February 16, 2007 03:39 PM UTC

Hi Chris,

How can I show an error icon in that cell if the validation fails?
>>>>>>
Please refer to the followinf forum thread for more details.
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=55049

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 19, 2007 02:15 PM UTC

Hi Haneef,

I checked your suggestion and I get stuck while drawing the error cell.

I want something similar what happens when throwing an exception -> showing an error icon on the right and the cell text just left of the error icon. Event when I click on that cell.

But the TableControlCellDrawn event only gives me a e.Inner.Bounds and I have no idea how to draw the icon on the right and the cell text left of the icon (indented).

Any help would be great
Cheers

Administrator [Syncfusion]
Replied On February 19, 2007 09:25 PM UTC

Hi Chris,

You can set the CurrentRecordProperty.Exception property to draw the error icon in a cell. Please try the attached sample and let me know if this helps.

[C#]
private void SetErrorText(object sender, string FiledDescriptorName,string ErrorMsg)
{
GridGroupingControl grid = sender as GridGroupingControl;
foreach (CurrentRecordProperty prop in grid.Table.CurrentRecordManager.Properties)
{
if(prop.FieldDescriptor.Name == FiledDescriptorName )
prop.Exception = new Exception(ErrorMsg, prop.Exception);
}
}

Here is a modified sample.
GGCValidIBindingListModified.zip

Best regards,
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

;