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
.
精彩评论