我在更新面板中有以下内容:
<asp:UpdatePanel ID="upAddProduct" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table border="0" cellpadding="2" cellspacing="2">
<tr>
<td align="left">
<asp:Label ID="lblCaption" runat="server"></asp:Label>
:
</td>
<td align="left">
<asp:TextBox ID="txtValue" runat="server" ValidationGroup="NewValues"></asp:TextBox>
<asp:RequiredFieldValidator ID="regInvData" ControlToValidate="txtValue" ErrorMessage="*"
runat="server" ValidationGroup="NewValues"></asp:RequiredFieldValidator>
<asp:HiddenField runat="server" ID="hdColType" />
<asp:HiddenField runat="server" ID="hdnSku" />
</td>
</tr>
<tr>
<td align="left">
</td>
<td align="left">
<asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClick="btnSubmit_Click"
ValidationGroup="NewValues" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>当我在上面的代码中点击submit按钮时,btnSubmit_Click没有被调用。
当我删除ValidationGroup="NewValues"时
函数被调用。
在将其保存在更新面板中之前,一切工作正常。
在上述情况下如何使用validationgroup?
请帮帮我。
发布于 2015-03-23 19:51:31
尝尝这个,
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table border="0" cellpadding="2" cellspacing="2">
<tr>
<td align="left">
<asp:Label ID="lblCaption" runat="server"></asp:Label>
</td>
<td align="left">
<asp:TextBox ID="txtValue" runat="server" ValidationGroup="NewValues">
</asp:TextBox>
<asp:RequiredFieldValidator ID="regInvData" ControlToValidate="txtValue"
ErrorMessage="*"
runat="server" ValidationGroup="NewValues"></asp:RequiredFieldValidator>
<asp:HiddenField runat="server" ID="hdColType" />
<asp:HiddenField runat="server" ID="hdnSku" />
</td>
</tr>
<tr>
<td align="left">
</td>
<td align="left">
<asp:Button ID="btnSubmit" Text="Submit" runat="server"
OnClick="btnSubmit_Click" ValidationGroup="NewValues"
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>对我来说很管用
https://stackoverflow.com/questions/29208932
复制相似问题