Sunday, 29 December 2013
0 comments

Computer Programming : TextBox WatermarkExtender control in Ajax with example

03:26
Computer Programming : TextBox WatermarkExtender is used to provide a tip to the user that specifies the type of parameter entered within the text box. This extender attaches to a TextBox control and displays a text within the text box when the web page render for the first time. When the user clicks the text box to insert values, the default text gets hidden.

Public Properties of TextBox Watermark Extender are

TargetControlID : Sets the .ID of the TextBox control to which you want to attach the extender
WatermarkText  : Sets the text to display when the value in the text box is empty.
watermarkCssClass : Sets the CSS class for the text box when it is empty.
 

Lets take a simple example

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="watermark-example.aspx.cs" Inherits="watermark_example" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div>
   
        <asp:TextBox ID="TextBox1" runat="server" Height="18px" Width="205px"></asp:TextBox>
        <asp:TextBoxWatermarkExtender ID="TextBox1_TextBoxWatermarkExtender" runat="server" Enabled="True" TargetControlID="TextBox1" WatermarkText="Use ; as a separator">
        </asp:TextBoxWatermarkExtender>
        <asp:Button ID="Button1" runat="server" Text="Search" BorderColor="Black" BorderStyle="Solid" BorderWidth="2px" Width="71px" />
   
    </div>
    </form>
</body>
</html>
Output
Computer Programming : Watermark Textbox example in asp.net

0 comments :

Post a Comment

ASP.NET VIDEO TUTORIAL

Loading...
 
Toggle Footer
Top