ShowPassword.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="1ShowPassword.aspx.cs" Inherits="ShowPassword" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 132px;
}
</style>
<script type="text/javascript">
function ShowPassword(checkBox)
{
var PasswordTextBox = document.getElementById('TextBox1');
if (checkBox.checked == true) {
PasswordTextBox.setAttribute("type", "text");
}
else
{
PasswordTextBox.setAttribute("type", "password");
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td class="auto-style2">Password</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td><input type="checkbox" onclick="ShowPassword(this)"/>Show Password</td>
</tr>
</table>
</div>
</form>
<p>
</p>
</body>
</html>
ShowPassword.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class ShowPassword : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
0 Comments