Guruji Point - Code You Want To Write

  • Home
  • Asp.Net
  • WCF
  • SQL
  • Type Script
  • AngularJS
  • Tech News
  • Blog
  • Earn Online

Monday, 9 October 2017

Ajax Control ToolKit TextBox WatermarkExtender Example In ASP.Net

 ajax textbox watermark, guruji point, Gurujipoint, watermark textbox control, watermark textbox in asp.net     No comments   


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" %>

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>

  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to TwitterShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Facebook Updates

Guruji Point

Categories

comma seperated string in sql Comman table Expression in SQL Dynamic Grid Row IQueryable in c# Learn AngularJS row_number() and dense_rank() salary table structure. Scope_Identity() Use of indexes while loop in sql why do we need cursor why tuple used

About Us

This blog is about the Programming ,Tech News and some intresting facts related Contents. Here you can find fundamental and expert level topic of programming languages very practically related to C# , Asp.Net ,Sql-Server, JavaScript, Jquery, WebServices And also Web-Api, WCF ,WPF, Angular Js.

Contact Us

Email Us - gurujipoints@gmail.com
Contact- 8077657477

Reach Us

Copyright © Guruji Point - Code You Want To Write