Elegant way to combine ASP.NET validation with JQuery

前端 未结 3 1288
误落风尘
误落风尘 2021-02-02 18:41

How can I best combine JQuery with ASP.NET client side validation model?

I\'ve generally avoided implementing ASP.NET validation model because it always seems overkill f

3条回答
  •  礼貌的吻别
    2021-02-02 18:58

    ASP.NET webforms and jQuery's validation model is very, very similar, IMHO, in that both are client-side and implementing one of them does not necessarily undermine the other. The only real difference would be that, behind the scenes, ASP.NET validators will cause the Page.Validate() method to returns false if you have an unvalidated field.

    You may opt to hand-roll your own validation controls, and then cause the same behavior, but as you yourself have stated, that might be overkill.

    jQuery also has its own Validator plugin which you might want to look at: http://docs.jquery.com/Plugins/Validation/Validator.

提交回复
热议问题