RequiredFieldValidator is not working properly with jQuery UI

后端 未结 1 1341
心在旅途
心在旅途 2020-12-18 14:33

I am working on ASP.NET Web Forms application. I have a pretty big form with a lot of fields so I want to take as much advantage as possible from the built-in server control

相关标签:
1条回答
  • 2020-12-18 15:07

    The RequiredFieldValidator from ASP.NET uses jQuery clientside which needs to be registered first (see here).

    Apparently, ASP.NET injects a <script> reference to jQuery in the first part of the form.

    If you registered your own <script> tags inside of the <head> of your page (first jQuery then jQuery UI), this effectively means you're losing your jQuery UI bindings because jQuery is referenced again after the <head> thanks to WebForms.

    The solution is to reference your scripts (jQuery, jQuery UI, and any custom scripts) at the end of the page, for example after the form element.

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题