开发者

show xval RulesException using jquery in Validationsummary

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 excep开发者_如何转开发tions in ValidationSummary when i return it as JsonResult?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜