2011-08-17 41 views
0

我有一些网页上的更新面板都设置为UpdateMode =“有条件的”,但是当一个更新面板上的AsyncPostBackTrigger触发时,所有的更新面板刷新。ASP.Net多个更新面板更新时,他们不应该

以下是更新面板的HTML标记之一:

<asp:UpdatePanel ID="pnls1FieldUpdate" runat="server" 
       UpdateMode="Conditional"> 
    <ContentTemplate> 
     <table class="FillInGrid" cellpadding="0" cellspacing="0"> 
      <tr> 
       <td> 
        <asp:TextBox ID="txtS1ExpDate" runat="server" Width="67px" TabIndex="14"></asp:TextBox> 
        <asp:ImageButton ID="cmdS1ExpDate" runat="server" 
         ImageUrl="~/images/calendar.png" TabIndex="15" /> 
        <asp:CalendarExtender ID="CalendarExtender6" runat="server" TargetControlID="txtS1ExpDate" PopupButtonID="cmdS1ExpDate" Format="dd/MM/yyyy"> 
        </asp:CalendarExtender> 
       </td> 
       <td> 
        <asp:DropDownList ID="cboS1ExpenseItem" runat="server" Width="200px" 
         onselectedindexchanged="cboS1ExpenseItem_SelectedIndexChanged" 
         AutoPostBack="True" TabIndex="16"> 
        </asp:DropDownList> 
       </td> 
       <td> 
        <asp:TextBox ID="txtS1ExpAmt" runat="server" Width="78px" ontextchanged="txtS1ExpAmt_TextChanged" TabIndex="18" AutoPostBack="True"></asp:TextBox> 
       </td> 
       <td> 
        <asp:TextBox ID="txtS1ExpGST" runat="server" Width="78px" TabIndex="19"></asp:TextBox> 
       </td> 
       <td> 
       <asp:TextBox ID="txtS1ExpOC" runat="server" Width="78px" 
         ontextchanged="txtS1ExpOC_TextChanged" TabIndex="20" AutoPostBack="True"></asp:TextBox> 
       </td> 
       <td> 
        <asp:Button ID="cmdAddSection1Exp" runat="server" Text="Add" Width="80px" 
         onclick="cmdAddSection1Exp_Click" TabIndex="21" /></td> 
      </tr> 
      <tr> 
       <td colspan="6"> 
        <table> 
         <tr> 
          <td class="HdrGnrl tRt" style="width:105px;">Sub item</td> 
          <td style="width:220px;"> 
           <asp:DropDownList ID="cboS1ExpenseSubItem" runat="server" Width="200px" 
            TabIndex="17"> 
           </asp:DropDownList> 
          </td> 
          <td style="width:85px;"></td> 
          <td style="width:85px;"></td> 
          <td style="width:85px;"></td> 
          <td style="width:100px;"></td> 
         </tr> 
        </table> 
       </td> 
      </tr> 
     </table> 
    </ContentTemplate> 
    <Triggers> 
     <asp:AsyncPostBackTrigger ControlID="txtS1ExpAmt" EventName="TextChanged" /> 
     <asp:AsyncPostBackTrigger ControlID="txtS1ExpOC" EventName="TextChanged" /> 
     <asp:AsyncPostBackTrigger ControlID="cboS1ExpenseItem" EventName="SelectedIndexChanged" /> 
    </Triggers> 
</asp:UpdatePanel> 
<asp:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender4" TargetControlID="pnls1FieldUpdate" runat="server"> 
    <Animations> 
     <OnUpdating> 
      <Sequence> 
       <FadeOut AnimationTarget="pnlExpense" minimumOpacity=".2" /> 
      </Sequence> 
     </OnUpdating> 
     <OnUpdated> 
      <Sequence> 
       <FadeIn AnimationTarget="pnlExpense" minimumOpacity=".2" /> 
      </Sequence> 
     </OnUpdated> 
    </Animations> 
</asp:UpdatePanelAnimationExtender> 

时,他们不应该为什么所有的UpdatePanel的更新?

回答

1

在您发布的代码中,只有一个UpdatePanel

但是,请注意,除了ChildrenAsTriggers Property被默认设置为true,所以AsyncPostBackTrigger会为每个是UpdatePanel内部控制自动添加。所以我想尝试的第一件事是将其设置为false

<asp:UpdatePanel ID="pnls1FieldUpdate" 
       runat="server" 
       UpdateMode="Conditional" 
       ChildrenAsTriggers="false" > 
+0

这是奇怪的,我所经历的就是这样,有问题的UpdatePanel的更新之后,其他的UpdatePanel slowwwwwly自我更新。我有ChidrenAsTriggers = false和UpdateMode =有条件的所有这些以及 – mattgcon

+0

页面设置的方式有很多的代码,我希望我可以改变它,但客户端想保持现在的状态 – mattgcon

+0

必须有在其他面板中触发更新的交互。由于您无法发布整个代码进行分析,因此最简单的方法是将其中的部分注释掉,然后重新启用它,以便找出问题。 – DavRob60