ModalPopupExtender OK Button click event not firing?

后端 未结 8 1427
旧巷少年郎
旧巷少年郎 2020-12-14 00:04

I have a Button inside an UpdatePanel. The button is being used as the OK button for a ModalPopupExtender. For some reason, the button click event is not firing. Any idea

相关标签:
8条回答
  • 2020-12-14 01:05

    I've found a way to validate a modalpopup without a postback.

    In the ModalPopupExtender I set the OnOkScript to a function e.g ValidateBeforePostBack(), then in the function I call Page_ClientValidate for the validation group I want, do a check and if it fails, keep the modalpopup showing. If it passes, I call __doPostBack.

    function ValidateBeforePostBack(){ 
         Page_ClientValidate('MyValidationGroupName'); 
         if (Page_IsValid) { __doPostBack('',''); } 
         else { $find('mpeBehaviourID').show(); } 
    }
    
    0 讨论(0)
  • 2020-12-14 01:07

    It appears that a button that is used as the OK or CANCEL button for a ModalPopupExtender cannot have a click event. I tested this out by removing the

    OkControlID="ModalOKButton"
    

    from the ModalPopupExtender tag, and the button click fires. I'll need to figure out another way to send the data to the server.

    0 讨论(0)
提交回复
热议问题