开发者

How to link ASP Asynchronous Postback with jQuery function

So I have a page with an < asp:UpdatePanel > every time that UpdatePanel updates my jQuery function is thrown out.

Right now I'm making sure the function fires when a user mouses over (.mouseenter) that DIV. Is 开发者_JAVA技巧there a way to make the function fire when an update happens?

I've tried .change, .ready, and .load but no luck.


You could try to create a script manager proxy on that page. Then - in the code-behind, register a "start-up" script that will fire each time the update panel refreshes.

In your markup, add the proxy for the script manager:

<asp:ScriptManagerProxy ID="scriptManagerProxy1" runat="server" />

Then, in your code behind, initiate the event:

 Private Sub scriptManagerProxy1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles scriptManagerProxy1.Load
        ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType(), Me.Page.UniqueID, "FunctionToCall();", True)
    End Sub

You may not need the proxy if you have the script manager on the same page/control - in which case you could probably use the load event of the script manager itself.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜