Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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...

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


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

1 solution

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

thanks
 
Share this answer
 
v3
Comments
Fabiyi Michael Ibukun 29-Jul-15 11:39am    
Thanks Animesh, but it didn't work. As I said earlier, this same code works in a new project. I think something might be wrong with configuration or settings of the project.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900