How do I force full post-back from a button within an UpdatePanel?

前端 未结 5 1896
南方客
南方客 2020-12-02 16:28

How do I force full post-back from a button within an UpdatePanel?

5条回答
  •  长情又很酷
    2020-12-02 17:17

    Its an old question there is bit tricky approach as well, when everything is in update panels and you want to do full post back so that your Document.Ready code works on click.

    1. Create a dummy button outside the update panel and click it from code behind like this

    ScriptManager.RegisterStartupScript(Page, this.GetType(), "ResetDoc", "ResetDocumentReady();", true);
    

    2. Define the function on front end like this

    function ResetDocumentReady() {
            $("[id$=DummyButton]").click();
        }
    

    NOTE: But the best way is using trigger, the answer posted by @Thibault Falise :)

提交回复
热议问题