处理事件验证 [英] handle event validation
问题描述
嗨!
我的问题是我在不同选项卡面板的aspx页面上有多个按钮.
并且我还在此页面的控件上使用了asp:validators,它们位于不同的net选项卡面板中.例如,在一个选项卡面板中,我有一个按钮和不同的控件..我想验证这些控件的值.同一页的其他选项卡上,我还有另一个带有不同控件且具有验证功能的按钮...现在,我希望在第一个选项卡面板中按下btton时,只应验证该面板的控件,并且按钮处理程序应触发事件,但问题是直到且除非未验证第二个Tabpanel的控件,否则不会触发该事件..我只想将按钮与该面板关联,而不要在单击第一个面板按钮时验证其他面板控件..
请解决此问题..
hi!
my problem is that i have multiple buttons on aspx page in different tab panels.
and i am also using asp:validators on controls of this page which are in differnet tab panels.for e.g in one tab panel i have a button and different controls..and i want to validate the values of these controls..and on the other tab of this same page i have another button with different controls with validation...now i want that in 1st tab panel when btton is pressed only control of that panel should be validated and the button handler should fire the event but the problem is that until and unless the controls of 2nd tabpanel are not validated the event doesnot get triggered..i want to associate the button with only that panel not the other panel controls should be validated when the 1st panel button is clicked..
please solve this problem..
推荐答案
指定验证组 [^ ]
此处的讨论 [
Specifying Validation Groups[^]
Same discussion here[^]
在要验证的所有控件上使用验证组以及触发验证的按钮
阅读此
http://msdn.microsoft.com/en-us/library/ms227424.aspx
Use Validation Group on all the controls you want to validate and the button that triggers validation
read this
http://msdn.microsoft.com/en-us/library/ms227424.aspx
请在该面板中的按钮和相应控件上添加"validationgroup"属性
例如:
您的第一个选项卡包含
1个文本框和1个名为
的按钮 txtname和btnsave
txtname.validationgroup =保存"和
brnsave,validationgroup =保存"
下一个面板包含,
1个文本框和1个名为
的按钮 txtage和btnsubmit
txtage.validationgroup ="Sub"
btnSubmit.validationgroup ="Sub"
即,为同一组中的控件提供相同的验证组名称
please add the "validationgroup" property to button and corresponding control in that panel
For eg:
Your first tabpanel contains,
1 textbox and 1 button named
txtname and btnsave
txtname.validationgroup="Save" and
brnsave,validationgroup="Save"
Next tabpanel contains,
1 textbox and 1 button named
txtage and btnsubmit
txtage.validationgroup="Sub"
btnSubmit.validationgroup="Sub"
ie,Giving same validation group name to controls in the same group
这篇关于处理事件验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!