alert box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sheenattt
    New Member
    • Nov 2006
    • 20

    #1

    alert box

    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
  • AricC
    Recognized Expert Top Contributor
    • Oct 2006
    • 1885

    #2
    Post your code so we can check.

    Comment

    • sheenattt
      New Member
      • Nov 2006
      • 20

      #3
      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

      Working...