Friday 25 February 2011

AJAX Toolkit Watermark extender example

AJAX  Toolkit provides a variety of controls and extenders.
In this blog  I would discuss use of Watermarkextender to
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"%>

  2. <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
  3. <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </cc1:ToolkitScriptManager>

  4. <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />

  5. <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1"  TargetControlID="TextBox2" WatermarkText="Enter username here" runat="server">
  6. </cc1:TextBoxWatermarkExtender>
Above code is example of  TextBoxWatermarkExtender .

    It has two important properties "TargetControlID" and "WatermarkText"
    TargetControlID: tells to which control this extender is attached.
    WatermarkText: tells the text which would be displayed in target control attached with TextBoxWatermarkExtender.
    Note When you are using  ajax toolkit controls always use ToolkitScriptManager instead of ScriptManager.
                        
                      

        1 comment:

        1. This is best one article so far I have read online. I would like to appreciate you for making it very simple and easy. I have found another nice post related to this post over the internet which also explained very well. For more details about that post check this url.....

          http://mindstick.com/Articles/263a6d0b-7988-4dc2-b041-4883356815e9/?Ajax%20Toolkit%20TextBoxWatermarkExtender%20Control%20in%20ASP.Net

          Thanks

          ReplyDelete