我有一个使用重复和更新面板的asp.net(3.5)页面,其中包含几个带按钮和图标的转发器,它们完美地工作直到我将它包裹起来。这是一个奇怪的问题,通过dilog工作完美但在回发后无法显示对话框标题,其他一切正常,它打开和关闭,并显示我需要它的信息。这显然是由部分回发引起的,即使我在部分页面回发中重新绑定jquery事件,我现在处于一个厕所。
$(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]);
});
});
以上工作完美+我的对话框按预期打开。
相同的代码也包含在更新面板模板中:
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function (evt, args) {
//CUTOUT
}
我的html / asp.net代码用于对话框如下并包含嵌套的中继器 - 再次表现完美但我遇到的问题(抱歉有点乱):
<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" CssClass="hidden" runat="server" Text='<%# Bind("req_Status") %>'></asp:Label> <asp:Label ID="lblIsNew" CssClass="hidden" runat="server" Text='<%# Bind("isNew") %>'></asp:Label>
如果有人有任何建议/意见或更好的做事方式,我将不胜感激。
干杯
答案 0 :(得分:0)
尝试更改
$('*[id*=ExtRefLink]').click(function ()
到
$('*[id*=ExtRefLink]').live('click', function ()