tags:

views:

502

answers:

2

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>

Which is used in an asp:UpdatePanel. My problem is that $(document).ready is never fired?

How can I detect when a partial rendering has finished?

+1  A: 

Put a method in your head tags and then in your placeholder call it. The problem here is that your PlaceHolder Visible="false" so it's never rendered. If you show it dynamically via ajax the script won't run. You'd have to rebind it when you dynamically show the placeholder. I would suggest not using document(ready) ...

rball
+2  A: 

This previous StackOverflow question is what you're looking for.

Peter J