connectseekers.com

Monday, 15 June 2015

Watermark In Asp.Net TextBox

6/15/2015 - By Pranav Singh 0

This article will show you how you can create a textbox with watermark inside an asp.net textbox control by using ajaxcontroltoolkit TextBoxWatermarkExtender.



So for this article first we will create a new asp.net application and add the TextBoxWatermarkExtender in form and add some textbox control. After this your page code will look as shown below.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="WebApplication2.WebForm4" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!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>Watermark In Asp.Net TextBox </title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
    </div>
    &nbsp;&nbsp;&nbsp; Name :
    <asp:TextBox ID="txtName" runat="server" Width="264px"></asp:TextBox>
    <br />
    <br />
    Address :
    <asp:TextBox ID="txtAddress" runat="server" Width="264px"></asp:TextBox>
    <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="txtName"
        WatermarkText="Please enter name">
    </cc1:TextBoxWatermarkExtender>
    <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" runat="server" TargetControlID="txtAddress"
        WatermarkText="Please enter address">
    </cc1:TextBoxWatermarkExtender>
    </form>
</body>
</html>

In above code I have assigned TargetControlID, WatermarkText and this two settings will allow to display the watermark inside the textbox.


About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com
Email Id : contact@aspdotnet-pools.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Top jQuery Plugins

Global Classified : Connectseekers.com
© 2014
back to top