首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用验证组时更新面板不起作用

使用验证组时更新面板不起作用
EN

Stack Overflow用户
提问于 2015-03-23 19:18:46
回答 1查看 762关注 0票数 1

我在更新面板中有以下内容:

代码语言:javascript
复制
<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">
                        &nbsp;
                    </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?

请帮帮我。

EN

回答 1

Stack Overflow用户

发布于 2015-03-23 19:51:31

尝尝这个,

代码语言:javascript
复制
<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">&nbsp;
</td>
<td align="left">
<asp:Button ID="btnSubmit" Text="Submit" runat="server" 
OnClick="btnSubmit_Click"  ValidationGroup="NewValues"
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>

对我来说很管用

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29208932

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档