c# - 更新面板不更新

标签 c# asp.net ajax gridview updatepanel

无论出于何种原因 - 我的更新面板没有更新。现在请注意,这一切都在 gridview 内模板字段的项目模板内。主要嵌套。 请帮帮我

<ItemTemplate>
   <asp:ImageButton ID="bttnEdit" runat="server" injid='<%# Eval("Id") %>' causeid='<%# Eval("Cause_Type") %>' natureid='<%# Eval("Nature_Type") %>' CausesValidation="False" ImageUrl="~/images/bttnEdit.gif" Text="Edit" OnClientClick ="loadmodal(this.injid,this.causeid,this.natureid);"  />
   &nbsp;<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" 
   CommandName="Delete" ImageUrl="~/images/bttnDelete.gif" Text="Delete" />
   <asp:Panel ID = "Pnlmodal" runat ="server" style="background-color:White; padding:1em 6px;">  
      <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional"  >
      <Triggers>
         <asp:AsyncPostBackTrigger ControlID ="bttnEdit" EventName ="Click" />
      </Triggers>
         <ContentTemplate>
            <asp:FormView ID="FormView2" runat="server" DefaultMode ="Edit" DataSourceID ="SqlDataSource8">
               <EditItemTemplate>
                  <table>
                     <tr>
                     <td colspan="2" align="center" style="color:Blue;font-size:large">Edit Injury</td>
                     </tr>
                     <tr><br /></tr>
                     <tr>
                        <td align="right" ><strong>What event caused the injury?</strong></td>
                        <td align="left">
                           <asp:DropDownList ID="ddlcauseofinj" onchange="showifother('1');" runat="server" 
                           DataSourceID="SqlDataSource2" DataTextField="Description" 
                           DataValueField="ID" AppendDataBoundItems="True">
                              <asp:ListItem Selected="True" style="color:gray" Value="0">Causes of Injury</asp:ListItem>
                           </asp:DropDownList>
                        </td>
                     </tr>
                     <tr id="trother1"  style="display:none">
                        <td align ="right"><strong>If Other, Please Describe:</strong></td>
                        <td align="left">
                        <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine"></asp:TextBox>
                        </td>
                     </tr>
                     <tr>
                        <td align="right"><strong>What is the extent of the Injury?</strong></td>
                        <td align="left">
                           <asp:DropDownList ID="ddlextentofinj" runat="server" 
                           onchange="showifother('2');" AppendDataBoundItems ="true"  DataSourceID="SqlDataSource3" 
                           DataTextField="Description" DataValueField="ID">
                           <asp:ListItem Selected="True" style="color:gray" Value="0">Extent of the Injury</asp:ListItem>
                           </asp:DropDownList>
                        </td>
                     </tr>
                     <tr id="trother2"  style="display:none">
                        <td align="right"><strong>If Other, Please Describe:</strong></td>
                        <td align="left">
                           <asp:TextBox ID="TextBox4" runat="server" TextMode="MultiLine" ></asp:TextBox>
                        </td>
                     </tr>
                     <tr>
                        <td align="right"><strong>Type of Medical Treatment:</strong></td>
                        <td align ="left">
                           <asp:DropDownList ID="DropDownList3" AppendDataBoundItems ="true"  runat="server" 
                           DataSourceID="SqlDataSource4" DataTextField="Description" DataValueField="ID">
                           <asp:ListItem Selected="True" style="color:gray" Value="0">Medical Treatments</asp:ListItem>
                           </asp:DropDownList>
                        </td>
                     </tr>
                     <tr>
                        <td align="right"><strong>Treatment Provider:</strong></td>
                        <td align="left">
                           <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Injury_Desc")%>'></asp:TextBox>
                        </td>
                     </tr>
                     <tr>
                        <td colspan ="2" align="center"><asp:ImageButton ID="CancelButton" runat="server" ImageUrl="~/images/bttnCancel.gif" /></td>
                     </tr>
                  </table>
               </EditItemTemplate>
            </asp:FormView>
         </ContentTemplate>
      </asp:UpdatePanel>
   </asp:Panel>
   <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
   TargetControlID="bttnEdit" PopupControlID="Pnlmodal" 
   BackgroundCssClass="modalBackground" Drag="True" />
</ItemTemplate>

最佳答案

我只是将更新面板包裹在整个网站周围。这接缝通常可以解决问题。事实上,您在 GridView 中有一个更新面板可能会弄乱面板的 id 并导致它不更新。

  1. 只需将 gridview 包裹在面板中

  2. 试用整个网站

关于c# - 更新面板不更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1572150/

相关文章:

c# - VB 中的 COM 对象数组

ASP.NET "access is denied"访问 UNC 路径时出错

c# - mvc3 应用程序中的 RDLC 报告

asp.net - 你能为 ASP.NET 推荐一个好的图像处理 dll 吗

javascript - 如何使用jquery将远程内容加载到对话框中?

javascript - 如何使用 Ajax 使用第一个选择框值更新 jquery 中的第二个选择框?

javascript - ajax 加载后 jQuery scrollTop 不起作用

c# - 添加单元测试项目时同名文件或文件夹已存在

c# - .Net 中隔离存储的真正目的是什么?

c# - 使用 iTextSharp 填写 PDF 表格并通过电子邮件发送填写好的表格