如何设置或删除按钮上的验证 [英] How to set or remove validation on buttons
本文介绍了如何设置或删除按钮上的验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是MVC的新手,我想删除取消按钮上的必需验证。
请告诉我如何从取消按钮中删除验证。
谢谢
Seema
I'm new in MVC, i want to remove Required Validation on Cancel button.
PLease tell me how I can remove validation from cancel button.
Thanks
Seema
推荐答案
您可以使用@ Html.ActionLink帮助方法将取消按钮转换为锚标记,并应用一个css类,使链接看起来像一个按钮,然后在该链接的控制器操作中,可以返回特定的视图。
@ Html.ActionLink(取消,索引,产品,null,新{@ class =clsButtonFake} )
或
在表格中使用2个提交按钮。一个用于真实提交,一个用于取消。并在您的控制器操作中,检查哪个按钮称为操作方法。
Either you can convert the Cancel button as an anchor tag with @Html.ActionLink helper method and apply a css class which makes the link to looks like a button and then in the controller action for that link, you can return the specific view.
@Html.ActionLink("Cancel","Index","Products",null, new { @class="clsButtonFake"})
or
Use 2 submit buttons in the form. One for real submit and one for the cancel. and in your controller action, check which button called the action method.
这篇关于如何设置或删除按钮上的验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文