I use .net RequiredFieldValidator control for those required fields validation, but I also need to verify fields using regular expression,and some other logic, so I also added OnClientClick event function to the submit button. But I found after addin开发者_JAVA技巧g the OnClientClick event, all requiredfieldvalidator validation events are not fired after clicking submit button. Why? if it is the mechanism, how can I use both of them?
I've run into the same problem in the past. I haven't dug into the why, but I've called the Page_ClientValidate('ValidationGroup')
javascript function directly in my OnClientClick event.
For example:
OnClientClick="if(Page_ClientValidate('Zip')) DoSomething();"
精彩评论