同一页面中不同按钮所需的feild验证器 [英] Required feild validators for different buttons in same page

查看:84
本文介绍了同一页面中不同按钮所需的feild验证器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个texbox和两个按钮,用于在ASPX页面中插入数据。我为这两个texbox设置了Requiredfieldvalidators,但是当我尝试从第一个文本框插入文本时,第二个文本框上的验证器也显示出来阻止我插入数据。我怎么解决这个问题?我必须为每个按钮制作特定的验证器。有没有办法?

I have two texboxes and two buttons to insert data in an ASPX page. I have set Requiredfieldvalidators for both these texboxes but when i try to insert text from first textbox the validators on second textbox also show up this prevent me from inserting data. How can i solve this problem? I have to make validators specific to each buttons. Is there any way?

推荐答案

将验证组设置为您的控件,如下所述:



For < b> TextBox1 和 Button1 设置ValidationGroup = GroupA

TextBox2 Button2 设置ValidationGroup = GroupB
Set validation groups to your control as mentioned below :

For TextBox1 and Button1 set ValidationGroup="GroupA"
For TextBox2 and Button2 set ValidationGroup="GroupB"


这篇关于同一页面中不同按钮所需的feild验证器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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