RequiredFieldValidator Working Oddly in Update Panel

前提是你 提交于 2019-12-02 03:55:59

Validate validators inside updatepanel on custom event.
You can try to invoke validation on 'blur' event with jquery (or other event 'click', 'change' ,'keypress', 'keyup' etc.). For example:

 function TextBoxValidate() {
    $('input:[type="text"]:[id*="client_name"]').each(function () { $(this).on('blur', function () { var txtId = this.id; $('span').each(function () { if (this.controltovalidate == txtId) ValidatorValidate(this); }); }); }); 
}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(TextBoxValidate);

Just add this code sample in your javascript file and include jquery library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!