更新面板刷新后,控件无法正常工作

时间:2017-06-27 06:48:39

标签: asp.net webforms

我使用位于UpdatePanel内的asp:Repeater构建表。该表的一列包含一些按钮。当按下这些按钮时,UpdatePanel会进行部分刷新(我认为..)。

奇怪的是,在另一个UpdatePanel内的表外部和顶部的某些OTHER按钮停止工作。

如果我不点击转发器中的按钮,它们的效果非常好。否则他们似乎不再响应click事件了。

澄清:刷新按钮继续工作。但即使是简单的复选框也不再适用。

以下是代码:

<div id="containerNotificationCenterDx">
                <!-- Contains the five buttons that stop working -->
                <div id="containerNotificationFilter">
                    <asp:UpdatePanel runat="server" ID="UpPnlBAction" UpdateMode="Conditional" ClientIDMode="static">
                        <ContentTemplate>
                            <div class="col11" style="padding-left: 10px">
                                <asp:CheckBox ID="cbSelectAllNotify" runat="server" CssClass="clickableRight" OnCheckedChanged="SelectAllNotify_CheckedChanged"
                                    AutoPostBack="true" />
                                <asp:LinkButton runat="server" ID="IndexImgRefreshCM" OnClick="IndexImgRefreshCM_OnClick" CssClass="clickableRight">
                                    <i class="fa fa-refresh"></i> <!-- this always works -->
                                </asp:LinkButton>                            
                                <asp:LinkButton runat="server" ID="IndexImgAddFilterCM" OnClientClick="return ajaxModalPopupAddFilterNotificationCenter();" CssClass="clickableRight">
                                    <span id="spanAddFilter">
                                        <i class="fa fa-filter"></i>
                                        <i class="fa fa-plus"></i>
                                    </span>
                                </asp:LinkButton>
                                <asp:LinkButton runat="server" ID="IndexImgRemoveFilterCM" OnClick="IndexImgRemoveFilter_OnClick" Enabled="false" CssClass="clickableRight">
                                    <span id="spanRemoveFilter">
                                        <i class="fa fa-filter"></i>
                                        <i class="fa fa-minus"></i>
                                    </span>
                                </asp:LinkButton>
                                <asp:LinkButton runat="server" ID="IndexImgExportCM" OnClientClick="return ajaxModalPopupExportDati();" CssClass="clickableRight">
                                    <i class="fa fa-file-excel-o"></i>
                                </asp:LinkButton>                                    
                                <asp:LinkButton runat="server" ID="IndexImgSmistaCM" OnClick="IndexImgSmista_OnClick" CssClass="clickableRight">
                                    <span id="spanSmista">
                                        <i class="fa fa-file-o"></i>
                                        <i class="fa fa-arrow-right"></i>
                                    </span>
                                </asp:LinkButton>
                                <asp:LinkButton runat="server" ID="IndexImgDeleteCM" OnClick="IndexImgRemove_OnClick" CssClass="clickableRight">
                                    <i class="fa fa-trash-o"></i>
                                </asp:LinkButton>
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>                    
                <!-- Main notifications container -->
                <div id="containerListNotify" style="padding-left: 5px;">
                    <asp:UpdatePanel ID="UpdatePanelRepListNotify" runat="server" UpdateMode="Conditional" ClientIDMode="Static">
                        <ContentTemplate>
                            <!-- DEFINISCE LA STRUTTURA DELLE NOTIFICHE -->
                            <asp:Repeater ID="repListNotify" runat="server" OnItemCommand="RepListNotify_ItemCommand"
                                OnItemDataBound="RepListNotify_ItemCreated">
                                <HeaderTemplate>
                                    <table id="tableCentroMessaggi" class="table table-hover">
                                        <thead>
                                            <tr id="HeaderMessaggi">
                                                <th>                                                   
                                                    <asp:Label runat="server" ID="docFascCol"  Text='<%#this.getDocFascColText() %>' />
                                                </th>
                                                <th>
                                                    <asp:Label runat="server" ID="dataCol"  Text='<%#this.getDataColText() %>' />
                                                </th>
                                                <th>
                                                    <asp:Label runat="server" ID="eventCol"  Text='<%#this.getEventColText() %>' />
                                                </th>
                                                <th>
                                                   <asp:Label runat="server" ID="fromCol"  Text='<%#this.getSenderColText() %>' />
                                                </th>
                                                <th>
                                                   <asp:Label runat="server" ID="objDescCol"  Text='<%#this.getObjDescColText() %>' />
                                                </th>
                                                <th>
                                                    <asp:Label runat="server" ID="tipologyCol"  Text='<%#this.getTipologyColText() %>' />
                                                </th>
                                                <th>
                                                    <asp:Label runat="server" ID="senderCol"  Text='<%#this.getEmailColText() %>' />
                                                </th>
                                                <th>
                                                    <asp:Label runat="server" ID="noteCol"  Text='<%#this.getNoteColText() %>' />
                                                </th>
                                                <th>
                                                    <asp:Label runat="server" ID="actionsCol"  Text='<%#this.getActionsColText() %>' />
                                                </th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <tr id="messageRow" runat="server">
                                        <td id="messageDetails">
                                            <div>
                                                <!-- checkbox rimozione notifica -->
                                                <asp:CheckBox ID="IndexChkRemoveNotify" CssClass="clickableLeftN" runat="server" />
                                                <!-- icona dettagli documento/fascicolo -->
                                                <asp:LinkButton runat="server" ID="IndexImgDetailsDocument" CommandName="ViewDetailsDocument" CssClass="clickableRight">
                                                </asp:LinkButton>
                                                <!-- id -->
                                                <br />
                                                <div class="notifyField">
                                                    <span class="noLink">
                                                        <asp:LinkButton ID="lblNotifyLink" runat="server" Text='<%#this.getLabelFieldLink((NttDataWA.DocsPaWR.Notification) Container.DataItem) %>' CommandName="viewLinkObject" OnClientClick="disallowOpHome('Content2');">
                                                        </asp:LinkButton>
                                                    </span>
                                                </div>
                                            </div>
                                        </td>

                                        <td id="date">
                                            <asp:Label ID="IndexLblDate" runat="server" Text='<%# Bind("DTA_EVENT") %>'></asp:Label>
                                        </td>

                                        <td id="mexEvent">
                                            <asp:Label ID="Label2" runat="server" Text='<%# GetEvent((NttDataWA.DocsPaWR.Notification) Container.DataItem) %>'></asp:Label>
                                        </td>

                                        <td id="mexSender">
                                            <asp:Label ID="Label3" runat="server" Text='<%# GetSource((NttDataWA.DocsPaWR.Notification) Container.DataItem) %>'></asp:Label>
                                        </td>

                                        <td id="objDescription">
                                            <asp:Label ID="Label4" runat="server" Text='<%# GetObjDesc((NttDataWA.DocsPaWR.Notification) Container.DataItem) %>'></asp:Label>
                                        </td>

                                        <td id="tipology">
                                            <asp:Label ID="Label5" runat="server" Text='<%# GetData((NttDataWA.DocsPaWR.Notification) Container.DataItem, Column.Tipology) %>'></asp:Label>
                                        </td>

                                        <td id="mittente">
                                            <asp:Label ID="Label7" runat="server" Text='<%# GetData((NttDataWA.DocsPaWR.Notification) Container.DataItem, Column.Sender) %>'></asp:Label>
                                        </td>

                                        <td id="note">
                                            <div id="containerNoteNotify" runat="server">
                                                <div class="fieldNotesHome">
                                                    <div class="fieldNotesHomeBt">
                                                        <div class="weight">
                                                            <asp:Label ID="lblNotes" Text='<%$ localizeByText:IndexLblNotes%>' runat="server"
                                                                Visible="false"></asp:Label>
                                                        </div>
                                                        <div style="padding-top: 30px; padding-left: 55px;">
                                                            <cc1:CustomTextArea ID="txtNoteNotify" runat="server" TextMode="MultiLine" ClientIDMode="Static"
                                                                CssClass="homeNotes">
                                                            </cc1:CustomTextArea>
                                                        </div>
                                                        <div style="text-align: right;">
                                                            <asp:Button ID="litSaveNotes" Text='<%$ localizeByText:IndexLitSaveNotes%>' CommandName="SaveNotesNotify"
                                                                runat="server" CssClass="buttonNotes" ImageAlign="Right"></asp:Button>
                                                            <asp:Button ID="litRemoveNotes" Text='<%$ localizeByText:IndexLitRemoveNotes%>' CommandName="RemoveNotesNotify"
                                                                runat="server" CssClass="buttonNotes" ImageAlign="Right"></asp:Button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </td>
                                        <!-- these buttons generate the issue -->
                                        <td id="actionsButtons">
                                            <div id="actionsButtonsContainer">
                                                <asp:LinkButton runat="server" ID="btnTypeDocCM" CommandName="ViewDocument" CssClass="clickableLeft"
                                                    ToolTip='<%$ localizeByText:IndexBtnTypeDocTooltip%>'>
                                                        <i class="fa fa-search"></i>
                                                </asp:LinkButton>
                                                <asp:LinkButton runat="server" ID="btnSignatureDetails" CommandName="SignatureDetails" CssClass="clickable"
                                                    ToolTip='<%$ localizeByText:DocumentSignatureDetails%>' Visible="false">
                                                        <i class="dettaglioFirma">&#xe800;</i>
                                                </asp:LinkButton>
                                                <asp:LinkButton runat="server" ID="IndexImgAdd" CommandName="AddNote" CssClass="clickableLeft"
                                                    Visible='<%#GetEnableNote() %>'>
                                                        <span class="fa-stack">
                                                            <i class="fa fa-file-o fa-stack-2x"></i>
                                                            <i class="fa fa-plus fa-stack-1x"></i>
                                                        </span>
                                                </asp:LinkButton>
                                                <asp:LinkButton runat="server" ID="IndexImgRemoveNotify" CommandName="RemoveNotify" CssClass="clickableRight">
                                                        <i class="fa fa-trash-o"></i>
                                                </asp:LinkButton>
                                            </div>
                                        </td>
                                    </tr>
                                    <asp:HiddenField runat="server" ID="NotifyId" Value='<%# Bind("ID_NOTIFY") %>' />
                                </ItemTemplate>
                                <FooterTemplate>
                                    </tbody>   
                                    </table>                                     
                                </FooterTemplate>
                            </asp:Repeater>
                            <asp:HiddenField ID="grid_rowindex" runat="server" ClientIDMode="Static" />
                            <asp:HiddenField ID="HiddenRemoveNotifications" runat="server" ClientIDMode="Static" />
                            <asp:HiddenField ID="HiddenRemoveNotification" runat="server" ClientIDMode="Static" />
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
                <asp:HiddenField ID="grid_pageindex" runat="server" ClientIDMode="Static" />
                <asp:UpdatePanel ID="upPnlGridIndexes" runat="server" ClientIDMode="Static" UpdateMode="Conditional">
                    <ContentTemplate>
                        <div id="navHome">
                            <asp:PlaceHolder ID="plcNavigator" runat="server" />
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>

我没有收到任何错误。

更新:&#34; UpPnlBAction&#34;中的所有控件UpdatePanel无法正常工作。

1 个答案:

答案 0 :(得分:0)

尝试添加更新面板ChildrenAsTriggers ="false",然后参阅

https://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.childrenastriggers(v=vs.110).aspx

检查这是否解决了您的问题