please have a look at this code........is it okCode:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script language="javascript" type="text/javascript"> function validate() { if(document.getElementById('TextBox1').value=="" && document.getElementById('TextBox2').value=="") { alert("Please enter the UserId and Password"); return false; } else if(document.getElementById('TextBox1').value=="") { alert("Please enter the UserId"); return false; } else if(document.getElementById('TextBox2').value=="") { alert("Please enter the Password"); return false; } else { return true; } } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Text="UserId :"></asp:Label> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <br /> <asp:Label ID="Label2" runat="server" Text="Password :"></asp:Label> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <br /> <asp:Button ID="Button1" runat="server" Text="Submit" OnClientClick="return validate()" /> </div> </form> </body> </html>




Reply With Quote