Here is the code.....
Expand|Select|Wrap|Line Numbers
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="changepassword.aspx.cs" Inherits="changepassword" %>
- <!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">
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>ABC Ltd. - change password</title>
- <script type="text/javascript">//starting of java script
- function validate()//funtion to validate field and password length
- {
- if (document.getElementById("name").value=="")
- {
- alert("You must enter Username!");
- document.getElementById("name").focus();
- return false;
- }
- if (document.getElementById("curnt_paswrd").value=="")
- {
- alert("You must enter old Password!");
- document.getElementById("curnt_paswrd").focus();
- return false;
- }
- if (document.getElementById("new_paswrd").value=="")
- {
- alert("New Password Field can not be blank!");
- document.getElementById("new_paswrd").focus();
- return false;
- }
- if(document.getElementById("con_frm_paswrd").value=="")
- {
- alert("Confirm Password field can not be blank!");
- document.getElementById("con_frm_paswrd").focus();
- return false;
- }
- if(document.getElementById("new_paswrd").value.length<6)
- {
- alert("Password should be at least six character long");
- document.getElementById("new_paswrd").focus();
- return false;
- }
- if((document.getElementById("new_paswrd").value)!=(document.getElementById("con_frm_paswrd").value))
- {
- alert("Confirm Password must match with the New Password")
- document.getElementById("con_frm_paswrd").focus();
- return false;
- }
- else
- {
- alert("You have successfully changed your old password")
- }
- //function windowclose()
- //{
- //window.close();
- //}-->
- }
- </script>
- <link href="style.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="main_container"></div>
- <!--header -->
- <div id="header">
- <h1 class="logo"><a href="#"><img src="Images/logo.gif" alt="funmobile-redifining mobile entertainment" title="funmobile-redifining mobile entertainment" /></a></h1>
- </div>
- <!--header ends here-->
- <div align="left">
- <form id="form1" runat="server" action="">
- <h3><span>Change Password</span></h3>
- <fieldset>
- <p>
- <label for="User Name" style="margin:0 55px 0 0;" >User Name</label>
- <asp:Textbox id ="name" runat="server" size="30" />
- </p>
- <p>
- <label for="" >Current Password</label>
- <asp:Textbox id="curnt_paswrd" textmode="Password" runat="server" size="30" />
- </p>
- <p>
- <label for="" style="margin:0 30px 0 0;" >New Password</label>
- <asp:Textbox id="new_paswrd" textmode="Password" runat="server" size="30" />
- </p>
- <p>
- <label for="" >Confirm Password</label>
- <input type="password" name="con_frm_paswrd" id="con_frm_paswrd" size="30" />
- </p>
- <p class="submit">
- <asp:button ID="btnChange" class="submit-button"
- OnClientClick="return validate()" runat="server" Text="Change"
- onclick="btnChange_Click"/>
- </p>
- </fieldset>
- </form>
- </div>
- <!--footer -->
- <div id="footer">© Funmobile. All Rights Reserved</div>
- </body>
- </html>