views:

223

answers:

2

hi. i got a updatepanel with a repeater in it. it display different events that i get from a calendar.

now what it want for it to do is i click on a event and it should display in a jquery dialog.

now this works great if i am not using a updatepanel but with it just wont work.

i been looking for it yesterday for some time and i seen some articles but i stil wont get the solution i am looking for..

    $(document).ready(function() {                 
                $("#btnCheck").click(function(evt) {
                    evt.preventDefault();                               

                    $(".dialog").dialog({ height: 700, width: 600, 
closeOnEscape: true, title: 'prev' }).dialog("open");
                });           
            });

        <div class="calendar_event_div">
            <asp:Repeater ID="repContent" runat="server" OnItemDataBound="repContent_OnItemDataBound" OnItemCommand="repContent_OnItemCommand">
                <ItemTemplate>                        
                    <asp:Literal ID="lbnEvent" runat="server" />
                    <asp:Literal ID="litEventBody" runat="server" />
                </ItemTemplate>
            </asp:Repeater>
        </div>

    </ContentTemplate>
</asp:UpdatePanel>
+2  A: 

Try to register your javascript with with the ScriptManager.RegisterScriptBlock(...), that will cause the js to be firered inside a updatepanel.

Also you could play around with the live command. Live will keep an eye out for any new element with the selector and assign the event to that.

$("#btnCheck").live("click", function(){
}
Johan Wikström
thanks for your answer Johan, i will look into the scriptmanager soon. i did not know that
Dejan.S
Anwar Chandra
+1  A: 

try to use livequery.

$("#btnCheck").live("click", function(evt){

    // your code

});

This method works and behaves very similarly to jQuery's bind method but with one important distinction: When you bind a "live" event it will bind to all current and future elements loaded by update panel controls.

Anwar Chandra
this worked great thanks.
Dejan.S
i will bring back solution soon
Dejan.S