SimpleModal breaks ASP.Net Postbacks

前端 未结 10 1954
名媛妹妹
名媛妹妹 2020-12-08 20:00

I\'m using jQuery and SimpleModal in an ASP.Net project to make some nice dialogs for a web app. Unfortunately, any buttons in a modal dialog can no longer execute their po

10条回答
  •  星月不相逢
    2020-12-08 20:48

    Both of you were on the right track. What I realized is that SimpleModal appends the dialog to the body, which is outside ASP.Net's

    , which breaks the functionality, since it can't find the elements.

    To fix it, I just modified the SimpleModal source to append eveything to 'form' instead of 'body'. When I create the dialog, I also use the persist: true option, to make sure the buttons stay through opening and closing.

    Thanks everyone for the suggestions!

    UPDATE: Version 1.3 adds an appendTo option in the configuration for specifying which element the modal dialog should be appended to. Here are the docs.

提交回复
热议问题