在同一个页面问题,有两种ASP.net按钮? [英] Two ASP.net buttons on same page problem?
问题描述
我有一个单独的页面上有两个按钮的ASP。以下面的格式
TextBox1中
必填字段validator1
BUTTON1
I have two asp buttons on a single page. In the following format textbox1 required field validator1 button1
TextBox2中
需要提起validator2
按钮2
textbox2 required filed validator2 button2
如果我继续导致验证的两个按钮真实的,那么它没有触发服务器端单击事件,但我可以使用所需的字段验证来验证这些文本框。
if I keep cause validation on both buttons true, then its not firing the server side click event, but I am able to validate these text boxes using required field validators.
如果我一直在这两个按钮这项事业验证错误的,它的发射服务器端click事件,但是我不能够使用需要提交验证器来验证这些文本框
If I keep this cause validation on both buttons false, its firing the server side click event, but I am not able to validate these textboxes using required filed validators
能否请你告诉我最好的解决办法
Can you please tell me the best solution
感谢
推荐答案
的CausesValidation
应该是双方真实。
您需要做的是设置的ValidationGroup
Button1Validation在TextBox1的验证和BUTTON1什么。设置Button2Validation的的ValidationGroup
在TextBox2中验证和按钮2。
What you need to do is set ValidationGroup
Button1Validation on the textbox1 validator and button1. Set a ValidationGroup
of Button2Validation on the textbox2 validator and button2.
验证组验证规则分成多个组,使各组不重叠并且相互干扰。
Validation groups separate validation rules into groups so that the groups don't overlap and interfere with each other.
这篇关于在同一个页面问题,有两种ASP.net按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!