In this post i will how to use Plain Text as Watermark for password TextBox in asp.net.
In the other post i was explained ASP.NET textbox with jQuery UI DatePicker
Code in ASPX page
In the other post i was explained ASP.NET textbox with jQuery UI DatePicker
Code in ASPX page
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master"
AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
// for Password
$(document).ready(function () {
$("[id$=txtusrpwdPlain]").show();
$("[id$=MainContent_txtusrpwd]").hide();
$("[id$=txtusrpwdPlain]").focus(function () {
$(this).hide();
$("[id$=MainContent_txtusrpwd]").show();
$("[id$=MainContent_txtusrpwd]").focus();
});
});
$(document).ready(function () {
$("[id$=txtusrpwd]").blur(function () {
if ($(this).val().length == 0) {
$(this).hide();
$("[id$=txtusrpwdPlain]").show();
}
});
});
// for User Nmae
$(document).ready(function () {
$("[id$=txtusrnmPlain]").show();
$("[id$=MainContent_txtusrnm]").hide();
$("[id$=txtusrnmPlain]").focus(function () {
$(this).hide();
$("[id$=MainContent_txtusrnm]").show();
$("[id$=MainContent_txtusrnm]").focus();
});
});
$(document).ready(function () {
$("[id$=txtusrnm]").blur(function () {
if ($(this).val().length == 0) {
$(this).hide();
$("[id$=txtusrnmPlain]").show();
}
});
});
</script>
<style type="text/css">
.watermark
{
font-family: Tahoma, Arial, sans-serif;
color: gray;
}
</style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<center>
<h2 style="color: #009933; font-size: large">
Plain Text as Watermark For Password TextBox
</h2>
<table>
<tr>
<td>
User Namr :
</td>
<td>
<asp:TextBox ID="txtusrnmPlain" runat="server"
Text="Enter UserName" ForeColor="Silver"></asp:TextBox>
<asp:TextBox ID="txtusrnm" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Password :
</td>
<td>
<asp:TextBox ID="txtusrpwdPlain" runat="server"
Text="Enter Password" ForeColor="Silver"></asp:TextBox>
<asp:TextBox ID="txtusrpwd" runat="server" TextMode="Password">
</asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="btnlogin" Text="Login" runat="server" />
</td>
</tr>
</table>
</center>
</asp:Content>
Its simple in using AJax Water MArk Control
ReplyDelete