ASP.NET/Jquery: document ready in refresh panel?
I have the following user control:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FadingMessage.ascx.cs" Inherits="includes_FadingMessage" %>
<asp:PlaceHolder Visible="false" runat="server" ID="plhMain">
<span id="<%= this.ClientID+"_panel" %>" style="background-color:yellow; padding:10px;">
<b><%= Message %></b>
</span>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
alert("never gets here??");
jQuery('#<%= this.ClientID+"_panel" %>').fadeOut(1000);
});
</script>
</asp:PlaceHolder>
Used in asp: UpdatePanel. My problem is that $ (document) .ready never runs?
How can I tell when a partial render has finished?
0
a source to share
2 answers
Place a method in your header tags and then call it in its placeholder. The problem here is that your PlaceHolder is Visible = "false", so it was never displayed. If you show it dynamically with ajax then the script won't work. You will have to reinstall it when you dynamically show the placeholder. I would suggest not using the document (ready) ...
+1
a source to share