且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

RequireFieldValidator也不在我的项目中的客户端工作

更新时间:2022-10-17 10:14:44

您好,

您还必须在TextBox中添加ValidationGroup =A。

< asp:textbox id =TextBox1runat =servervalidationgroup =A>< / asp:textbox> 



感谢


Hello guys, I really need your help. All Validation controls on every page in my project don't work in client-side. the button_Click event fires immediately the button is clicked even when the validation isn't true. I put the code below in my project and in a new project, it works perfectly in client-side in the new project. Is something wrong with my App.Settings or Web.config? Please help.
Here's the code

<asp:TextBox ID="TextBox1" runat="server">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="RequiredFieldValidator" ValidationGroup="A">


<asp:TextBox ID="TextBox2" runat="server">


<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" ValidationGroup="A" />

My code behind is...

protected void Button1_Click(object sender, EventArgs e)
        {
            TextBox2 = TextBox1;
        }



I'd appreciate a quick and favorable response. Thanks.

Hello ,
You have to add ValidationGroup="A" in TextBox also .
<asp:textbox id="TextBox1" runat="server" validationgroup="A"></asp:textbox>


thanks