开发者

Using ASP.NET validators on multiple controls

can we use the same validator of a control for two different buttons, or do we need to write add a valida开发者_JAVA技巧tor for each control for two different buttons.


Each ASP.NET validator control can be bound to exactly one ControlToValidate, except for the CompareValidator. The CompareValidator also has a ControlToCompare property. You need to add a validator for each control you wish to validate.

When you find that your markup gets bloated with validators, you can also create a handy extension methods on Control and let it automaticaly add a new validator to the page. You can invoke this method in your code behind in OnPreInit or OnInit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜