开发者

Showing server-side validation in ASP.NET MVC in jQuery modal dialog

开发者 https://www.devze.com 2023-03-27 08:51 出处:网络
When using a jQuery modal dialog in asp.net mvc3. How would you redisplay the dialog after posting to the ActionResult and redisplaying serverside vali开发者_如何学Pythondation errors. In otherwords I

When using a jQuery modal dialog in asp.net mvc3. How would you redisplay the dialog after posting to the ActionResult and redisplaying serverside vali开发者_如何学Pythondation errors. In otherwords I would like to know how to display serverside errors in the modal dialog. Or redisplay the modal with server side validation errors after post.

Thanks in advance.


With regard re-displaying the dialog; don't. Leave it open and close it in an onsuccess handler from your (presumably) Ajax form. I suggest using a PartialView for the content of your dialog.

You can render the errors in your dialog by using Html.ValidationSummary().

0

精彩评论

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