RequiredFieldValidator have to click twice

后端 未结 7 2047
遇见更好的自我
遇见更好的自我 2020-12-17 05:52

I have run into the same problem as described here.

Only the question is marked as answered with only an explanation as to why you may have to click twice when using

7条回答
  •  离开以前
    2020-12-17 06:13

    $(function() {
    $("input.btn").on("click",function(){
    if(Page_BlockSubmit == true) {Page_BlockSubmit = false};
    })
    });
    

    Page_BlockSubmit is a JS variable defined by the js generated from code behind when you define the validator . I haven't went deeper to know why MS need this variable, but the scenario is:

    the first click will make Page_BlockSubmit become false. the second click will check the value of Page_BlockSubmit and return true.

    if you implemented the code I posted, every time you click the button, the variable will be set as false which will trigger the submit at every click.

    And, you can use google chrome to trace the value of Page_BlockSubmit.

提交回复
热议问题