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

Asynchronous Validation from WCF Service

1 Answer 63 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 22 Oct 2011, 07:58 PM
In my CellValidating Event I am passing the "GridViewCellValidatingEventArgs e" object to a WCF Service Call to compare the field value against a list of valid options in a DB Table.

When the Async process completes (WebService_ValidateColACompleted(object sender, ValidateColACompletedEventArgs e) event) and returns back a Boolean value to indicate the success, if the validation succeeds (e.Result == true), the functionality is field value is left as-is since it is valid.

If the validation fails (e.Result == false), then I am using the e.UserState to reference the original GridViewCellValidatingEventArgs object and am doing the following:

GridViewCellValidatingEventArgs eOrig = ((GridViewCellValidatingEventArgs)e.UserState);
eOrig.ErrorMessage = "Validation failed.";
eOrig.IsValid = false;

Stepping through the code, the ErrorMessage and IsValid values are being updated, but the field in the grid is not turning red or showing the error.

I am assuming this is due to the Asynchronous call, but would like to know a good solution to this issue.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 24 Oct 2011, 07:42 AM
Hi,

 I suggest you to check this blog post for more info how to achieve your goal. 

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Matthew
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or