Asp.net Updatepanel + Jquery UI Dialog Missing title Issue
I've an asp.net (3.5) page using a repeated and an updatepanel, containing several repeaters with buttons and icons which worked perfectly until I wrapped the up around it. It is a strange issue where by the dilog works perfectly but after postback fails to show the dialog title, everything else works fine it opens and closes and shows the information I need it to. This is clearly caused by the partial postback even though I'm rebinding the jquery events within the part page postback, and I'm now at a loos.
$(document).ready(function() {
$('*[id*=dialog-ExtRef]').dialog({
modal: false,
resizable: false,
minWidth: 500,
autoOpen: false,
buttons: {Ok: function () { $(this).dialog("close");}}
});
$('*[id*=ExtRefLink]').click(function () {
var targetDialog = $(this).attr("func")
var x = ($("#mainBody").outerWidth() + 20) / 2 - 250;
var y = $(this).position().top - $(document).scrollTop() + 10;
$("#" + targetDialog + "").dialog("open").dialog('option', 'position', [x, y]);
});
});
The above works perfectly + my dialog opens as intended.
The same code is also wrapped in the update panel template within:
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function (evt, args) {
//CUTOUT
}
My html/asp.net code is for the dialog is as follows and contains nested repeaters - again performing perfectly but the problem I'm experiencing (sorry a bit messy):
<ItemTemplate>
<div class="categoryHeader ui-widget-header"><asp:Label ID="lblCategoryName" runat="server" Text='<%# Bind("param_Value") %>'></asp:Label><asp:Label ID="lblCategoryID" runat="server" Text='<%# Bind("param_ID") %>' CssClass="hidden"></asp:Label></div>
<div class="categoryBody">
<asp:Repeater ID="rpSubCategory" runat="server" >
<ItemTemplate>
<div style="width:auto; padding:5px 5px 5px 5px;">
<table style="width:100%;" cellpadding="4" cellspacing="0"><tr>
<td style="width:5%;"><asp:LinkButton ID="delRequest" CommandArgument='<%# Bind("req_identifier") %>' runat="server">Delete Request</asp:LinkButton></td>
<td style="width:45%;"><asp:LinkButton ID="lnkViewRequest"
CommandArgument='<%# Bind("ass_ID") %>' runat="server"
Text='<%# Bind("req_headline") %>'></asp:LinkButton><br />Currently with: <asp:Label ID="Label1" CssClass="infoItem" runat="server" Text='<%# Convert.ToString(Eval("assigned_To")).ToUpper() %>'></asp:Label> since: <asp:Label ID="Label2" CssClass="infoItem" runat="server" Text='<%# Bind("req_Date","{0:dd/MM/yyyy}" ) %>'></asp:Label></td>
<td style="width:30%;"><asp:Label ID="Label5" runat="server" Text='<%# Bind("req_Priority","Priority: {0}") %>'></asp:Label><br /><asp:Label ID="Label6" runat="server" Text='<%# Bind("req_Status","Status: {0}") %>'></asp:Label></td>
<td style="width:20%; text-align:right;">
<div id='<%# Eval("ass_ID","NoteLink{0}") %>' func='<%# Eval("ass_ID","dialog-message{0}") %>' class="divLink"><asp:Image ID="noteImage" runat="server" ImageUrl="~/Image/note.png" ToolTip="Request Note Quick View" /></div>
<div id='<%# Eval("ass_ID","dialog-message{0}") %>' title="Quick View - Request Notes">
<p>
<asp:Label ID="lblID" Visible="false" runat="server" Text='<%# Eval("req_identifier") %>'></asp:Label>
<asp:ObjectDataSource ID="ObjectDataSource3" runat="server"
SelectMethod="getNotesTableByRequest" TypeName="derby.prototype.requestNotes">
<SelectParameters>
<asp:ControlParameter ControlID="lblID" Name="requestID"
PropertyName="Text" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="ObjectDataSource3">
<ItemTemplate>d<br /></ItemTemplate>
</asp:Repeater>
</p>
</div>
<div id='<%# Eval("ass_ID","ExtRefLink{0}") %>' func='<%# Eval("ass_ID","dialog-ExtRef{0}") %>' class="divLink" ><asp:Image ID="refImage" runat="server" ImageUrl="~/Image/world_go.png" ToolTip="External Reference Quick View" /></div>
<div id='<%# Eval("ass_ID","dialog-ExtRef{0}") %>' title="Quick View - External References">
<p>
<asp:ObjectDataSource ID="ObjectDataSource4" runat="server"
SelectMethod="getReferencesTableByRequest"
TypeName="derby.prototype.requestReferences">
<SelectParameters>
<asp:ControlParameter ControlID="lblID" Name="requestID"
PropertyName="Text" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:Repeater ID="Repeater2" runat="server" DataSourceID="ObjectDataSource4">
<ItemTemplate>d<br /></ItemTemplate>
</asp:Repeater>
</p>
</div>
</td>
</tr></table></div>
<asp:Label ID="Label4" CssClass="hidden" runat="server" Text='<%# Bind("req_Priority","Priority: {0}") %>'></asp:Label><asp:Label ID="Label3" Cs开发者_StackOverflow社区sClass="hidden" runat="server" Text='<%# Bind("req_Status") %>'></asp:Label> <asp:Label ID="lblIsNew" CssClass="hidden" runat="server" Text='<%# Bind("isNew") %>'></asp:Label>
I'd be grateful to hear if any one has any suggestions/comments or better ways of doing things.
Cheers
try changing
$('*[id*=ExtRefLink]').click(function ()
to
$('*[id*=ExtRefLink]').live('click', function ()
精彩评论