asp.net中未触发按钮回发
我在更新面板中有一个按钮。当我点击按钮时,它不会点击服务器端的点击方法。不知道发生了什么事。下面是你们的代码。任何关于可能发生的事情的见解都会非常有帮助。按钮的ID为btnPost。它是下面更新面板的一部分asp.net中未触发按钮回发,asp.net,vb.net,asp.net-ajax,Asp.net,Vb.net,Asp.net Ajax,我在更新面板中有一个按钮。当我点击按钮时,它不会点击服务器端的点击方法。不知道发生了什么事。下面是你们的代码。任何关于可能发生的事情的见解都会非常有帮助。按钮的ID为btnPost。它是下面更新面板的一部分 <asp:UpdatePanel ID="atlaspnlpost" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Pane
<asp:UpdatePanel ID="atlaspnlpost" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="pnlPost" runat="server" Style="width: 855px" GroupingText="Accounting use only">
<table class="MainSectionBody" style="width: 855px">
<tr style="height: 30px">
<td style="width: 165px">
<asp:Label ID="Label4" runat="server" Text="Accounting Date" Width="160px"></asp:Label>
</td>
<td style="width: 200px">
<asp:TextBox ID="txtAcctDate" runat="server" Width="200px" TabIndex="13" Text="01/18/2018"></asp:TextBox>
</td>
<td style="width: 85px">
<a runat="server" id="lnkAcctDate" style="cursor: hand">
<asp:Image ID="Image2" runat="server" ImageUrl="~/Images/calendar_small.gif" TabIndex="98">
</asp:Image></a>
<asp:CompareValidator ID="cvAccDate" runat="server" ErrorMessage="Accounting Date is Required"
Operator="DataTypeCheck" SetFocusOnError="True" Type="Date" ControlToValidate="txtAcctDate">*</asp:CompareValidator>
</td>
<td style="width: 405px">
<asp:CheckBox ID="chkApprove" Text="Approved By Accounting" runat="server" TabIndex="14" />
</td>
</tr>
<tr style="height: 30px">
<td style="width: 165px">
<asp:Label ID="lblApprover" runat="server" Text="Approver Name" Width="160px"></asp:Label>
</td>
<td style="width: 200px">
<asp:TextBox ID="txtApprover" runat="server" Width="200px" SkinID="ReadOnlyTextBox"
ReadOnly="True" TabIndex="99"></asp:TextBox>
</td>
<td style="width: 85px">
<td style="width: 405px">
<%--<asp:Button ID="btnPost" runat="server" Text="Post" Width="76px" TabIndex="15" />--%>
</td>
</tr>
<tr style="height: 30px">
<td style="width: 165px">
<asp:Label ID="lblDescription" runat="server" Text="Description" Width="160px"></asp:Label>
</td>
<td style="width: 200px">
<asp:TextBox ID="txtdescription" runat="server" Width="200px" TabIndex="99"
TextMode="MultiLine"></asp:TextBox>
</td>
<td style="width: 85px">
<td style="width: 405px">
<%-- <asp:Button ID="btnPost" runat="server" Text="Post" Width="76px" TabIndex="15" />--%>
</td>
</tr>
<tr style="height: 30px">
<td style="width: 165px">
<asp:Label ID="lblFinanceexplanation" runat="server" Text="FinanceExpalnation" Width="160px"></asp:Label>
</td>
<td style="width: 200px">
<asp:TextBox ID="txtFinanceExplanation" runat="server" Width="200px" TabIndex="99"
TextMode="MultiLine"></asp:TextBox>
</td>
<td style="width: 85px">
<td style="width: 405px">
<asp:Button ID="btnPost" runat="server" Text="Post" Width="76px" TabIndex="15" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnRefresh" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="ddlYear" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
您看到向按钮添加了一个属性
OnClick="btnPost_Click"
应该是这样的:
<asp:Button ID="btnPost" runat="server" Text="Post" OnClick="btnPost_Click" Width="76px" TabIndex="15" />
尝试添加按钮作为updatepanel的回发触发器?我不知道您的代码是如何工作的,请记住注释是客户端注释,而不是服务器端注释。如果不是这样,那么页面中是否有属性AutoEventWireup=true?@hardkoded-查看注释下面的几行。按钮btnPost未注释。我还看了AutoEventWireup。它被设置为false。
<asp:Button ID="btnPost" runat="server" Text="Post" OnClick="btnPost_Click" Width="76px" TabIndex="15" />