简体   繁体   English

客户端和服务器端的ASP.NET验证控件的内部工作

[英]Internal works of ASP.NET Validation controls in client and server side

I want to know how ASP.NET validation controls are working (eg: requiredfield validator, regular expression validator). 我想知道ASP.NET验证控件的工作方式(例如:requiredfield验证程序,正则表达式验证程序)。 What will really happening when clicking on the button? 单击该按钮时会发生什么? What are the events are fireing on client side? 客户端触发了哪些事件? What really happening internally? 内部到底发生了什么?

When you click on the button (if you you defined CausesValidation="true") button send request to server with __doPostBackWithOptions function aims which contains valiadtion group as parameter (if you defined ValidationGroup property for your button). 当您单击按钮(如果您定义了CausesValidation =“ true”)时,按钮将使用__doPostBackWithOptions函数目标将请求发送到服务器,该函数目标包含变量组作为参数(如果您为按钮定义了ValidationGroup属性)。 __doPostBackWithOptions contains function Page_ClientValidate. __doPostBackWithOptions包含函数Page_ClientValidate。 In this case will be checked all validators which belong for this group. 在这种情况下,将检查属于该组的所有验证器。 If result (Page_IsValid) will be true postback occures. 如果结果(Page_IsValid)为true,则会发生回发。 If You don't define validationGroup (but CausesValidation true) will be checked all validators which is present on page. 如果您未定义validationGroup(但CausesValidation为true),则将检查页面上显示的所有验证器。 If defined CAusesValidation false will use _doPostBack function without validators checking. 如果定义了CAusesValidation false,则将使用_doPostBack函数,而无需验证程序进行检查。 More information here: http://msdn.microsoft.com/en-us/library/aa338815(v=vs.71).aspx and http://msdn.microsoft.com/en-us/library/aa479045.aspx 此处的更多信息: http : //msdn.microsoft.com/en-us/library/aa338815 ( v = vs.71).aspxhttp://msdn.microsoft.com/en-us/library/aa479045.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM