开发者

How to link ASP Asynchronous Postback with jQuery function

开发者 https://www.devze.com 2023-04-10 10:36 出处:网络
So I have a page with an < asp:UpdatePanel > every time that UpdatePanel updates my jQuery function is thrown out.

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

精彩评论

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

关注公众号