【问题标题】:Update panel with each row in repeater用中继器中的每一行更新面板
【发布时间】:2018-02-17 11:01:30
【问题描述】:

我有中继器,当我在每一行中放置更新面板时,它仍在加载所有其他更新面板,这有什么原因吗?

它应该只更新我想要实现的那部分。

<asp:Repeater runat="server" ID="grd" >
        <HeaderTemplate>
            <table class=" table-serviceline table table-hover table-bordered">
        </HeaderTemplate>
        <ItemTemplate>
            <tr class="service-line-item" id="<%#"serviceline"+ Eval("ClaimServiceID") %>">

                <td class="fw65">

                    <table class="table-small-pad">
                        <tr>
                            <td>
                                <asp:Label ID="lblID" ClientIDMode="Static"  Text='<%#Container.ItemIndex+1 %>' runat="server"></asp:Label>
                            </td>                                                   
                        </tr>                                               
                    </table>

                </td>

                <td class="fw150">
                    <table class="table-small-pad">
                        <tr>
                            <td>
                            <asp:UpdatePanel ID="upd" runat="server">
                                  <ContentTemplate>
                                  <div class="input-group">                                
                                     <asp:TextBox ID="txtCODE" runat="server" CssClass="form-control" Text='<%# Bind("Code") %>' ToolTip="Code" MaxLength="15" />
                                     <span class="input-group-addon"></span>
                                  </div>
                                  </ContentTemplate>
                                  </asp:UpdatePanel>
                            </td>                                                   
                        </tr>                                              
                    </table>
                </td>                                       
            </tr>

        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>

【问题讨论】:

  • 为什么不在Repeater之外只使用一个更新面板?数据绑定代码在哪里?
  • 我的回答有帮助吗?请帮助社区并让我们知道。

标签: asp.net webforms updatepanel


【解决方案1】:

我相信这个组合

UpdateMode="Conditional" 

ChildrenAsTriggers="True"

在 UpdatePanel 中是您要查找的内容。如果不设置第一个参数,UpdatePanels 会在任何回发时更新。

【讨论】:

  • 另外,需要想办法为每个UpdatePanel分配不同的ID。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多