简体   繁体   English

ASP.NET服务器端或客户端的验证控件?

[英]Validation Controls for ASP.NET Server side or client side?

Does the validation controls in ASP.NET works in server side as well as client side? ASP.NET中的验证控件是否适用于服务器端和客户端? or it is for client side validation only? 或者它仅用于客户端验证?

Thanks 谢谢

ASP.NET validation control perform both client side and server side validation. ASP.NET验证控件执行client sideserver side验证。 EnableClientValidation is the property to disable client side validation. EnableClientValidationdisable客户端验证的属性。

Quoted from MSDN Document for ASP.NET Validation Controls 引自MSDN Document for ASP.NET Validation Controls

Validation controls perform input checking in server code. 验证控件在服务器代码中执行输入检查。 When the user submits a page to the server, the validation controls are invoked to check the user input, control by control. 当用户向服务器提交页面时,将调用验证控件以检查用户输入,通过控件进行控制。 Validation occurs after page initialization (that is, after view state and postback data have been processed) but before any change or click event handlers are called. 在页面初始化之后(即,在处理了视图状态和回发数据之后)但在调用任何更改或单击事件处理程序之前进行验证。

ASP.NET performs validation on the server even if the validation controls have already performed it on the client, so that you can test for validity within your server-based event handlers. 即使验证控件已在客户端上执行验证,ASP.NET也会在服务器上执行验证,以便您可以在基于服务器的事件处理程序中测试其有效性。

You can invoke validation in your own code by calling a validation control's Validate method 您可以通过调用验证控件的Validate方法在您自己的代码中调用验证

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

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