如何在mvc中的ancor标签上应用数据注释验证? [英] How to apply data annotation validation on ancor tag in mvc ?
本文介绍了如何在mvc中的ancor标签上应用数据注释验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我在asp.net的视图中使用了锚标签,并在点击该锚标签时通过jquery打开弹出窗口。
Hi I am using anchor tag in my view in asp.net and open a popup through jquery on clicking on that anchor tag.
<a href="#" id="guarantor-link">@Model.Guarantor</a>
我想对该锚标记应用必要的验证。
其默认值为select。
请帮忙怎么做?
我尝试了不同的解决方案,但他们并没有帮助我。
I want to apply required validation on the that anchor tag.
Its default value is select.
Please help how can I do that?
I have tried different solutions, but they didn''t help me out.
推荐答案
你不需要使用数据验证这个的注释。请编写javascript或jquery脚本以验证这一点。
else使用属性@ Model.Guarantor添加隐藏字段并为该属性添加必需属性。
You don''t need to use data annotation for validating this. Please write javascript or jquery script for validating this.
else add a hidden field with the property @Model.Guarantor and put required attribute for that property.
这篇关于如何在mvc中的ancor标签上应用数据注释验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文