Asp.NET中的验证控件 [英] Validation Controls in Asp.NET
问题描述
朋友,
我在母版页中具有2个文本框和1个提交按钮(ASP.NET控件),并具有必需的字段验证.
我有1个页面(默认)与此母版页面一起使用,并且该默认页面具有2个文本框和1个提交按钮(HTML控件),并为此使用JQuery或JS编写验证.
当我运行此应用程序时,我单击默认页面提交"按钮,母版页验证也同时运行....
在这种情况下,请大家帮我..
谢谢您
Hi Friends,
I have 2textboxes and 1 submit button(ASP.NET Controls) in master page with required field validation.
I have 1 page(Default) with this master page and that default page have 2 text boxes and 1 submit button (HTML controls) and using JQuery or JS write validations for that.
When i was run this application I click on Default page submit button, master page validations also run at same time ....
Can you please guys help me in this situation ..
THANK YOU
推荐答案
为两个文本框和按钮包括Group Validation
,并将相应的字段与该组关联.示例如下:
IncludeGroup Validation
for the two textboxes and button and associate the corresponding field with that Group. Example given below:
<pre lang="xml">
<asp:TextBox ID="tb1" runat="server" />
<asp:requiredfieldvalidator id=""ReqField1"" controltovalidate="tb1" mode="hold" validationgroup="valGroup1" errormessage="Required" runat=Server />
<asp:imagebutton id="Button2" causesvalidation="true" mode="hold" validationgroup="valGroup2" ImageUrl="img.gif" runat=Server >
您可以在HTML
标签
中使用validation group
像这样
Hi ,
You can usevalidation group
inHTML
tag
like this
<input id="Button2" type="button" value="button" runat="server" validationgroup="" />
最好的问候
米特瓦里(M.Mitwalli)
Best Regards
M.Mitwalli
这篇关于Asp.NET中的验证控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!