Question : How can I tied up a JQuery event after a Postback?

HI,
I have a page and inside the page I have a web user control and inside that web user control There is another web user Control.
 
Page
   ------------------------------------------------------------
  |      Web User Control 1                                          |
  |    ----------------------------------------------------      |
  |    |  Web user Control 2                                   |      |
  |    |    ------------------------------------------        |      |                                          
  |    |    |                                                       |        |      |
  |    |    |                                                       |        |      |
  |    |    ------------------------------------------        |      |
  |    |---------------------------------------------------       |
  |-----------------------------------------------------------

This is inside my "Web User Control 1" :
     $(document).ready(function() {
        alert("sss");
        $('a#<%= this.ClientID %>slick-up').livequery('click', function(event) {
            $('#<%= this.ClientID %>slickbox').toggle(600);
        });
        return true;
    });
<a id="<%= this.ClientID %>slick-up" href="#" ><img id="SearchImage" src="images/DateArrowDown.png" /></a>
      <div id="<%= this.ClientID %>slickbox">  
            <asp:PlaceHolder ID="EnrollmentDayResourceList" runat="server"></asp:PlaceHolder>
        </div>

This Placeholder contain the Web User Control 2.

So far everything works great. .....BUT.... when an event is fire in "Web User Control 2"  and do a post back the JQuery function in "Web user Control 1" stop working.

Somebody can explain me why is that............
Thanks

ps: Why I am using  the client ID? this is because in the server side I am repeating controls and setting up their CliendID.

Answer : How can I tied up a JQuery event after a Postback?

$(document).ready will only fire once when the document is fully loaded into the browser the first time.
Any AJAX call doesn't trigger the event.

Registering a script via RegisterStartupScript will fire the function after the document is fully loaded into the browser AND after each partial postback.

This would be the script to register:

NB From what I see in your clientcode you use live event binding on a link with a certain id.
Using live, the event gets bound each time a certain element (which is valid against the selector being used in the live event) get into the DOM.
So perhaps using the live event with a class selector is a better solution??
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
$('a#" + this.ClientID + @"slick-up').livequery('click', function(event) {
  $('#" + this.ClientID + @"slickbox').toggle(600);
  // perhaps return false?
});


// using live events with a class selector
$("a.slick-up").live("click", function() {
  $(".slickbox", this).toggle(600); // finding element with className slickBox inside the link
  return false;
});
Random Solutions  
 
programming4us programming4us