开发者

Showing jQueryUI Modal After Postback

开发者 https://www.devze.com 2023-03-21 06:12 出处:网络
I have an ASP.NET page with a simple form and a submit button. Upon submission, I am displaying results on an AJAX UpdatePanel, which works just as desired. However, now I would like to use jQuery UI

I have an ASP.NET page with a simple form and a submit button. Upon submission, I am displaying results on an AJAX UpdatePanel, which works just as desired. However, now I would like to use jQuery UI to display these results on a modal window instead, but the problem is that 开发者_StackOverflow社区I must call the jQuery code in the OnClientClick event, which occurs just before the postback. I need, of course, to display it after postback, which is when information gets retrieved from the server... How can I accomplish this?


Putting your modal dialog open call inside of a script that you define in your code behind inside of the ScriptManager.RegisterStartupScript method should do the trick.


You can use the update panel animation extender

http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/UpdatePanelAnimation/UpdatePanelAnimation.aspx

<ajaxToolkit:UpdatePanelAnimationExtender ID="ae"
  runat="server" TargetControlID="up">
     <Animations>
        <OnUpdated> **WRITE YOUR JAVASCRIPT HERE** </OnUpdated>
    </Animations>
</ajaxToolkit:UpdatePanelAnimationExtender>


2 possible approaches; used both on a recent project. One approach is to register a script on the postback which re- renders the modal dialog. The alternative (and if memory serves this is what we used in the end) was setting the update panel to conditional mode and during the postback the modal dialog isn't hidden.

Just to clarify, the updatepanel was contained in a JQueryui dialog and we show() 'ed it on submit

0

精彩评论

暂无评论...
验证码 换一张
取 消