views:

49

answers:

1

I have a method which will return JsonResult or RedirectToRouteResult based on some conditions in my asp.net mvc (C#) application.

The RulesException can be shown in <%= Html.ValidationSummary()%>, if i use return RedirectToAction(.....).

How can i show the rules exceptions in ValidationSummary when i return it as JsonResult?

A: 

Hi Prasad, I'm not really sure if this is going to fit your needs and it is not direct answer to your question, but version 1.0 of xVal has support for client side validation summaries. Maybe this way you don't have to bother if result is JSON...

    <div id="validationSummary">
    <%= Html.ValidationSummary("Please fix the following problems:") %>
    </div>

and..

<%= Html.ClientSideValidation("booking", typeof(Booking))
    .UseValidationSummary("validationSummary") %>

Here you can read more about it.

Hope this was helpfull, regards.

Misha N.