Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
455
IGrid - Using ValidationSummary along with UpdateUrl
posted

I am using the IGrid and batch updating.  I have a page with the following...

@Html.ValidationSummary()
@(Html.Infragistics().Grid(Model.GetAllGmiProducts()).UpdateUrl(Url.Action("EditingSaveChanges", "Gmi"))

... rest of grid here

My controller method looks like this...

[

ActionName("EditingSaveChanges")]
public ActionResult EditingSaveChanges(GmiModel model)
{

    GridModel m = new GridModel();
    List<Transaction<GmiProduct>> transactions = m.LoadTransactions<GmiProduct>(HttpContext.Request.Form["ig_transactions"]);

    //perform some validation on 'transactions' here, add a model error to modelState if that validation fails

       ModelState.AddModelError(string.Empty, "Error occurred!");

    if (!model.ModelState.IsValid)
    {
        return View("Index", model);
    }

    JsonResult result = new JsonResult();
   
Dictionary<string, bool> response = new Dictionary<string, bool> { { "Success", true} };
       result.Data = response;
   
    return
result;

}

My problem is that the validation summary never displays my error messages.  I assume this is because the grid is doing an ajax call to the controller method, so the page is never fully redrawn.

What is the best way to deal with this?  How can I get the ValidationSummary to be redrawn when the grid update does not return success?  I have also tried throwing exceptions from inside my controller method and responding to the requestError event of the grid, but I have been unsuccessful in getting that to work as well.