This is a migrated thread and some comments may be shown as answers.

Problem validating the reuired fileds in the Add mode.

0 Answers 27 Views
GridView
This is a migrated thread and some comments may be shown as answers.
SivaPrasad Bevara
Top achievements
Rank 1
SivaPrasad Bevara asked on 23 May 2012, 02:36 PM
Hi,

I am using Telerik controls for Silverlight 5.

I wanted to validate the gridview row(Which have required fields) in the add mode.
I am trying to handle this in the RowValidating event.

I am doing this as below ( I am using a DTO object for loading the gird).

1)  Added an dependency property(IsRequired = true/false)
2)  Checking that property in the rowvalidating event to know whether it is required filed or not
3)  If it is required then I am checking its values,
4)  If the value is null then I am adding that to the "GridViewCellValidationResult" and finally I am adding that to the e.ValidationResults as below.

GridViewCellValidationResult validationResult = new GridViewCellValidationResult();
validationResult.PropertyName = propertyname;
validationResult.ErrorMessage = "ERROR: Column " + propertyname +" cannot be blank.";
e.ValidationResults.Add(validationResult);

I am doing the above, by looping through the all the columns. So All the error messages are added to a single message box.

The problem with this is, the summarised error message is displayed only after clicking on the last errored cell. I mean the error message is not showing up on the other cells till we get  into the last errored cell (which is added to the validationresult last).

I wanted to show the summarised message once the user get in to any cell whcih has the error or on mosue hover of the errored row.
Also I wanted to remove the errors from the message box one by one as the user fixes it.
Also I wanted to remove the error background automatically once all the errors fixed.

Please help.

Regards,
SivaPrasad.B

No answers yet. Maybe you can help?

Tags
GridView
Asked by
SivaPrasad Bevara
Top achievements
Rank 1
Share this question
or