I am working in C#.Net and using JavaScript to validate my form.When I use the inbuilt Validators of ASP.Net like "Required Field Validator" or any other,it wont work with JavaScript.Can anyone tell me why?Or how can I make it work with JS?Do help.Thanks
alert box
Collapse
X
-
Here JS is working fine but Validator Message box is not.Do help.Thnx
Code:<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <script language="javascript"> function check() { if(form1.DDMONTH.value=="") { alert("Select month"); return false; } } </script> <body> <form id="form1" runat="server"> <asp:TextBox ID="TextBox1" runat="server" Height="18px" Width="111px"></asp:TextBox> <asp:DropDownList ID="DDMONTH" runat="server"> </asp:DropDownList> <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="Enter numeric value" Operator="DataTypeCheck" SetFocusOnError="True" Type="Integer"></asp:CompareValidator> <asp:ValidationSummary ID="ValidationSummary1" runat="server" Height="43px" ShowMessageBox="True" Width="175px" /> <asp:Button ID="Button1" runat="server" Text="Submit" Font-Bold="True" Width="97px" OnClick="Button1_Click" OnClientClick="return check()" />Comment
Comment