jquery dialog in updatepanel with repeater
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");
开发者_如何学C });
});
<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>
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(){
}
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.
精彩评论