Introduction
In this post we will learn how to implement ajax control toolkit Textbox watermark extender in Asp.net using c#. Watermark textbox in asp.net c#.
Previous Updates
In previous articles we have learnt Encrypt Connection String in Web.config file. Convert DataSet to List or GenericList in Asp.Net. Top 30 Asp.Net interview question and answers. What is WebApi and advantage of API.
Description
The ASP.Net AJAX TextBoxWatermarkExtender control is used to apply Watermark Text to TextBoxes i.e. Displaying an Informative text when the TextBox is empty and hide it when user tries to type in the Text in TextBox.
Steps
1. Register the AJAX Control Toolkit Library after adding reference to your project.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="asp" %>
TagPrefix="asp" %>
2. Drag an ASP.Net AJAX ToolScriptManager on the page.
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
3. Then you need to add the ASP.Net AJAX TextBoxWatermarkExtender control next to each TextBox control which you want to set the Watermark feature.
Here are three important properties of this control:
1. TargetControlID – This is ID of the TextBox to which the ASP.Net AJAX TextBoxWatermarkExtender control is associated.
2. WatermarkText – It displayed when the TextBox is empty.
3. WatermarkCssClass – This CSS class It is used to set the color and style for the Watermark Text.
You may also Read - Transaction Commit and Rollback in sql server with example
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
.Watermark
{
color:#AAA;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<table border="0" cellpadding="0" cellspacing="2">
<tr>
<td>
Name:
</td>
<td>
<asp:TextBox ID="txtName" runat="server" />
<asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1"
runat="server" TargetControlID="txtName"
WatermarkText="Enter Name." WatermarkCssClass="Watermark">
</asp:TextBoxWatermarkExtender>
</td>
</tr>
</table>
</form>
</body>
</html>
kuşadası
ReplyDeletemilas
çeşme
bağcılar
mersin
4LP6
urla transfer
ReplyDeleteözdere transfer
güzelbahçe transfer
bergama transfer
dikili transfer
DEXU6
ayvalık transfer
ReplyDeleteçeşme transfer
urla transfer
akbük transfer
davutlar transfer
RY27