Water mask is used for displaying message I a control to
user that what he need to enter in it. So in this article I will show you how
you can display watermark in a textbox using TextBoxWatermark Contol Of
AjaxControlToolKit in asp.net.
Some of my previous article : Display
Watermark Text in a Password TextBox Using jQuery In Asp.Net
So for this article first we will create a new asp.net application in it’s page we
will add a textbox , TextBoxWatermark,
ScriptManager control. Now check the below code.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ControlValidationByAjaxControltoolKit.Default"
%>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="asp"
%>
<!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>TextBoxWatermark
Contol Of AjaxControlToolKit For Displaying Watermark in TextBox In Asp.Net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Enter Name:<asp:TextBox ID="TextBox1" runat="server" Width="189px"></asp:TextBox>
<asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server"
TargetControlID="TextBox1"
WatermarkText="Please
enter name">
</asp:TextBoxWatermarkExtender>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</div>
</form>
</body>
</html>
|
So for displaying the watermark text we have to define the following
properties of TextBoxWatermark.
TargetControlID="TextBox1"
WatermarkText="Please
enter name
Now check the propertied of water mark textbox.
- TargetControlID - The ID of the TextBox to operate on
- WatermarkText - The text to show when the control has no value
- WatermarkCssClass - The CSS class to apply to the TextBox when it has no value (e.g. the watermark text is shown).
So we have done
DOWNLOAD
0 comments:
Please let me know your view