在一个页面中的两个按钮时重新排列字段验证器 [英] requered field validator when two button in one page

查看:55
本文介绍了在一个页面中的两个按钮时重新排列字段验证器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了重新加注的字段验证器,但是我在这个页面上有两个按钮。在两个页面上都会触发验证。当我点击button1然后验证将会激活。当我点击第二个按钮时,我不必触发验证。但是验证当我点击第二个按钮时也会触发。我必须做什么?

I have used requered field validators ,but I have two button on this page.validation will fire on both page.when I click button1 then validation will fire.I have to not fire validation when I click on second button.But validation also fire when i click on second button.what i have to do?

推荐答案

您可以使用ValidationGroup属性。为button1和RequiredfieldValidator1分配相同的值,为其他分配不同。



如果您需要任何帮助,请告诉我。
You can use ValidationGroup property. Assign same value for button1 and RequiredfieldValidator1 and different for other.

Let me know if you need any help.


使用CausesValidation =False代表第二个按钮
Use CausesValidation="False" for second button


我认为您在页面上有两个按钮,并且您只想在第一个按钮上激活验证。如果你只想这么做,你可以将CausesValidation属性设置为false为第二个按钮



从属性窗口执行





< asp:button id =Button2text =Validate>

onclick =Button2_Click

causevalidation = false runat =Server/>
What I think is that you have two buttons on the page and you want to fire the validation only on 1st button. if you want to do only this much than for this you can set the CausesValidation property as false for 2nd button

Do it from the property window
or

<asp:button id="Button2" text="Validate" >
onclick="Button2_Click"
causesvalidation=false runat="Server" />


这篇关于在一个页面中的两个按钮时重新排列字段验证器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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