Add WaterMark to TextBox (TextBoxWatermarkExtender)

Posted: October 7, 2010 in AJAX, ASP.Net

When trying to add a WaterMark to a TextBox control, you can try the following using the Ajax Control Toolkit:

<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns="">
<head runat="server">
    <title>WaterMark Extender</title>
    <form id="frm_main" runat="server">
        <asp:ScriptManager ID="scr_main" runat="server" />
        <asp:UpdatePanel ID="ajax_upd_pnl_main" runat="server">
                <div id="div_main">
                    <asp:TextBox ID="txt_year" runat="server"></asp:TextBox></div>
                    <cc1:TextBoxWatermarkExtender ID="wme_txt_year" runat="server" TargetControlID="txt_year" WatermarkText="(year)"></cc1:TextBoxWatermarkExtender>          

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s