Asynchronous Validation from WCF Service

2 posts, 0 answers
  1. Matthew
    Matthew avatar
    46 posts
    Member since:
    Aug 2011

    Posted 22 Oct 2011 Link to this post

    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.

  2. Vlad
    Vlad avatar
    11100 posts

    Posted 24 Oct 2011 Link to this post


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

    Kind regards,
    the Telerik team

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

Back to Top