从操作方法发送的数据出现在模态对话框 [英] send data from action method to appear in modal dialog

查看:150
本文介绍了从操作方法发送的数据出现在模态对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用与jQueryUI的asp.net mvc的

Im using asp.net mvc with jqueryui

我已经把默认登录HTLM(附带一个新创建的MVC项目),并把它放在一个jQuery模态对话框。登录似乎工作没关系。但是林不知道如何,我的意思来处理错误。我想它只是显示在模态对话框...

I have placed the default logon htlm (that comes with a new created mvc project) and placed it in a jquery modal dialog. login seems to work okay. However Im not sure how I'm meant to handle errors. I'd like it to just show up in the modal dialog...,

模态对话框是好的,当它错误例如,如果必填字段丢失,(它显示在对话框中)

The modal dialog is fine when it errors if for example a required field is missing, (it shows up in the dialog)

但登录action方法返回视图(模型);如果有与该认证所述凭证输入的任何错误(用户/口令是无效的)

but the LogOn action method returns View(model); if there are any errors with the authenticating the credential entered( user/password are invalid)

我怎样才能让这个误差修改这些拿到对话框中呈现呢?

how can i make it so that these erros get rendered within the dialog too?

推荐答案

我建议你检查的我的博客文章在那里我提供最佳的解决方案,使用Ajax调用处理验证错误。

I suggest you check my blog post where I provide the best possible solution to handling validation errors using Ajax calls.

为了让事情重复使用,不重复code中的解决方案提供了行为过滤器处理某些异常。在这种情况下,自定义异常。

To make things reusable and to not repeat code the solution provides an action filter that handles certain exceptions. In this case a custom exception.

一切都描述的很详细,并提供所有code解释。当你看着它在最后但尽管如此,它其实很简单。检查出来。

Everything is described and explained in great detail and all code is provided. It's actually very trivial when you look at it at the end but nevertheless. Check it out.

这篇关于从操作方法发送的数据出现在模态对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆