开发者

What's the best choice for developing real time form validation in ASP.NET

开发者 https://www.devze.com 2022-12-30 03:54 出处:网络
I want to make a real time form validation in asp.net form in which when开发者_运维知识库 i lost focus a field it show an error or success of field entrance data

I want to make a real time form validation in asp.net form in which when开发者_运维知识库 i lost focus a field it show an error or success of field entrance data
i search for best way to do that ..

and if i want to do the same by validating data from SQL Database ... what's the best choice for doing that ?


  • jQuery Validator

    is by far your best option


Before you go into best user experience in form validation you have to put some consideration while implementing it,
the validation must always be in the server side and never go only in client side validation in case the user disables javascript or he can change the validation expression using some tools, therefor there is two ways you do it.
ajax validation or multiple validation
in Ajax validation when the user focus out the item it directly posts the data to server validates it and then you put the UI and do validation on submit too.
or you make validation in javascript for the UI without AJAX and then you do other validation in server side on submit. it means you need to copy the validation expressions once in server and once in javascript.

after you decide which method you go then you find the most appropriate tool for it. and I recommend you to go with jQuery plugins they are very easy to use


ASP.NET Server Validation Controls in conjunction with ValidatorCallout from Ajax Control Toolkit is also a good option. It can do validations on both server and client end. Obviously it will require more effort than jQuery.

0

精彩评论

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

关注公众号