MVC 3中选项卡的数据注释验证和焦点控制 [英] Data annotation validation and focus control of tab in MVC 3

查看:57
本文介绍了MVC 3中选项卡的数据注释验证和焦点控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用数据注释进行模型验证。我有标签控件,其中包含所需的项目。虽然我在没有在所需项目中插入值的情况下发布页面,但数据注释验证会暂停该过程,但选项卡内的项目无法集中。



这会让表单有错误但没有验证错误。



任何人都可以解决这个问题。



谢谢

Prakash Bhatta

Hi,

I am using data annotation for model validation. I have tab control which contains item that are required. While I post the page without inserting value in the item that is required, data annotation validation halt the process but item inside the tab doesn''t get focused.

This make illusion that form has error but no validation error.

Can any one get out me from this problem.

Thanks
Prakash Bhatta

推荐答案

确保验证模型状态并返回带有错误消息的视图。我希望你错过那个部分,因为你的UI没有看到任何变化。
Ensure that you validate Model State and return a View with Error Message. I hope you are missing that part because of which you don''t see any changes in your UI.


这篇关于MVC 3中选项卡的数据注释验证和焦点控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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