<asp:UpdatePanel>在表<tr>中不起作用?

ste*_*haw 6 c# asp.net ajax

<asp:UpdatePanel..><table>.. <tr> </tr>结构中工作时遇到问题,我不知道为什么.当UpdatePanel被注释掉时,一切正常,但是当我取消注释UpdatePanel时,<tr> </tr>标记的内容甚至都没有显示在Visual Studio 2010中.当我运行网页但UpdatePanel不显示时,会显示此内容工作.我这个项目中没有其他网页有这个问题但是,我再次使用<div>s代替<table> s.另一件事.该在我的MasterPage中.这是我的脚本:

<asp:UpdatePanel ID="W9UpdatePanel" runat="server" UpdateMode="Always">
    <ContentTemplate>
        <tr>
          <td colspan="6">
            <div class="branchSetupSectionTitle">W-9 Information:</div>
          </td>
        </tr> 
        <tr>
           <td colspan="2">
             <asp:Button ID="btnDownloadW9Pdf" runat="server" 
             Text="Download W-9"  onclick="btnDownloadW9Pdf_Click" AutoPostBack="True" /> 
             <%--<asp:RegularExpressionValidator ID="RegularExpressionValidator24" 
              runat="server" ControlToValidate="txtFirstPaymentAmount" Display="Dynamic" 
              ErrorMessage="The dollar amount you entered is in the wrong format." 
              ForeColor="Red" ValidationExpression="^\d+(\.\d\d)?$">*</asp:RegularExpressionValidator>--%>
              <asp:CheckBox ID="chkW9FormSubmitted" runat="server" AutoPostBack="True" 
              oncheckedchanged="chkW9FormSubmitted_CheckedChanged" 
              Text=" I have submitted this W-9 Form" />
            </td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
         </tr> 
    </ContentTemplate>
</asp:UpdatePanel>

   </tr>
Run Code Online (Sandbox Code Playgroud)

该事件将触发按钮和复选框,但整个页面都会刷新.谢谢你的帮助.

小智 5

UpdatePanel需要渲染div或span才能正常运行.由于这两个元素都不能在表行之间呈现,因此UpdatePanel没有占位符来呈现回发响应html,因此它不起作用.

在您的情况下,解决方法可能是查看页面的哪个部分不需要位于更新面板中并将其保留在外部.您可以只保留<td colspan="2">UpdatePanel内部的内容.