【问题标题】:Asp.net Updatepanel + Jquery UI Dialog Missing title IssueAsp.net Updatepanel + Jquery UI 对话框缺少标题问题
【发布时间】:2011-06-15 15:13:15
【问题描述】:

我有一个使用重复和更新面板的 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>

如果有人有任何建议/cmets 或更好的做事方式,我将不胜感激。

干杯

【问题讨论】:

    标签: jquery asp.net jquery-ui updatepanel


    【解决方案1】:

    尝试改变

    $('*[id*=ExtRefLink]').click(function ()
    

    到

    $('*[id*=ExtRefLink]').live('click', function ()
    

    【讨论】:

    • 还是同样的问题,其他一切都可以通过对话框进行,只是缺少标题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-26
    • 2012-10-21
    • 2011-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多