Friday, March 10, 2017

Avoid Multiple time Submit button click event

<asp:Button ID="btnSubmit" runat="server" class="btn btn-success"  OnClick="btnSubmit_Click"
                      ValidationGroup="Submit" Text="Submit" OnClientClick="if (!Page_ClientValidate()){ return false; } this.disabled = true; this.value = 'Saving...';"
   UseSubmitBehavior="false"></asp:Button>

Thursday, January 19, 2017

Entity Framework with LINQ aggregate to concatenate string

DataTypeID, Name, DataValue
1,"Data 1","Value1"
1,"Data 1","Value2"
2,"Data 1","Value3"
3,"Data 1","Value4"


var query = (from t in context.TestData
group t by new { DataTypeID = t.DataTypeID, Name = t.Name } into g
select new { DataTypeID = g.Key.DataTypeID, Name = g.Key.Name, Data = g.AsEnumerable()})
.ToList()
.Select (q => new { DataTypeID = q.DataTypeID, Name = q.Name, DataValues = q.Data.Aggregate ("", (acc, t) => (acc == "" ? "" :
acc + ",") + t.DataValue) });

Wednesday, July 20, 2016

Maintain Scroll Position of DIV on PostBack in ASP.Net

<div id="dvScroll" style="overflow-y: scroll; height: 260px; width: 300px">
    1. This is a sample text
    <br />
    2. This is a sample text
    <br />
    3. This is a sample text
    <br />
    4. This is a sample text
    <br />
    5. This is a sample text
    <br />
    6. This is a sample text
    <br />
    7. This is a sample text
    <br />
    8. This is a sample text
    <br />
    9. This is a sample text
    <br />
    10. This is a sample text
    <br />
    11. This is a sample text
    <br />
    12. This is a sample text
    <br />
    13. This is a sample text
    <br />
    14. This is a sample text
    <br />
    15. This is a sample text
    <br />
    16. This is a sample text
    <br />
    17. This is a sample text
    <br />
    18. This is a sample text
    <br />
    19. This is a sample text
    <br />
    20. This is a sample text
    <br />
    21. This is a sample text
    <br />
    22. This is a sample text
    <br />
    23. This is a sample text
    <br />
    24. This is a sample text
    <br />
    25. This is a sample text
    <br />
</div>
<hr />
<input type="hidden" id="div_position" name="div_position" />
<asp:Button Text="Submit" runat="server" />
 
<script type="text/javascript">
window.onload = function () {
    var div = document.getElementById("dvScroll");
    var div_position = document.getElementById("div_position");
    var position = parseInt('<%=Request.Form["div_position"] %>');
    if (isNaN(position)) {
        position = 0;
    }
    div.scrollTop = position;
    div.onscroll = function () {
        div_position.value = div.scrollTop;
    };
};
</script>
 
 
 
 

Wednesday, December 23, 2015

Disply category and sub category

SELECT        TOP (100) PERCENT catName, ID, ParentMenuId, LinkPage
FROM            (SELECT        ISNULL(C.Name + '>', '') + ISNULL(B.Name + '>', '') + A.Name AS catName, A.ID, A.ParentMenuId, A.Name AS LinkPage
                          FROM            dbo.ISMenu AS A LEFT OUTER JOIN
                                                    dbo.ISMenu AS B ON A.ParentMenuId = B.ID LEFT OUTER JOIN
                                                    dbo.ISMenu AS C ON B.ParentMenuId = C.ID) AS P

Thursday, June 12, 2014

Using Google Translator to Change Language in your Website

In this article we will be using Google Translator to change the Language Dynamically for the pages whose data are being generated from the database.


Introduction


Hello Friends,

Just recently had posted a question in the forum that I wanted to change the language of my website according to the user selection.I did get responses but unfortunately there was not much I get from ASP.NET globalization and localization.After searching through, we came across one blog where there was Google Translator that was powered by Google and was able to change the language of the Blog completely.

Bingo ! That was it, what we needed.

Let us see how we can change the language of the website globally without using Globalization and Localization.

To use Google translator you will have to visit :- https://translate.google.com/manager/website/

Objective


  1. Understanding Google Translator.
  2. Adding it to the website.

Understanding Google Translator and its Features

  1. Instantly translate your website into 60+ languages using Google's Translate
  2. Customize and improve the translation of your website
  3. Collect and use translation suggestions from your users
  4. Invite editors to manage translations and suggestions

Using the code


  1. First you need to go to https://translate.google.com/manager/website/
  2. Then Click on Add to Website, Once you click Add to Website it will ask you to login using your GMail Credentials.
  3. Once You Login it will ask you for you website URL and ask to choose your Default Language for website (Check Screen 1).
  4. Once you add the website URL.Click on Next for Further settings.
  5. The Further settings includes the Look of the Drop Down of selection of Languages, How many Languages you need, Do you want to add google analytics code for tracking traffic (Check Screen 2).
  6. Now we are done with the settings and we will now click on Get Code Button.
  7. Once we Click on the Get Code we get the piece of Code snippet.Now here is the trick to get a Global Conversion we will add the Code Snippet to the Master Page so that it affects all the pages with the content as well :) (Check Screen 3 for Code)




Screen 1



Screen 2






Screen 3




Lets start Implementation

  1. Create a New Empty Website -> Add a Master Page and 2 Web Forms and Include the Master Page to that web form.
  2. Now go to the Head section of the master page and paste the first piece of code snippet
  3. Now once you paste the Head section code. Now paste the second piece of Code snippet on the master page as per your display requirement.
  4. This piece of Code snippet should be inside a DIV Tag.
  5. Now Go to the Content Pages and Bind a Grid from database.(Check the Code for Binding In Code Section 3)
// Head Section of Master Page (Code Section 1)
<meta name="google-translate-customization" content="18e07a495bcfdebb-6e21f50c844b7cb0-g60562cca66703d3b-3b"></meta>
// Second Piece of Code Snippet (Code Section 2)
<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL, multilanguagePage: true}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
        
Explanation of the Code 

The code is nothing but a JavaScript function which connects to the Google Translator Service, gets the languages based on your selections made in the previous steps and gives the look and feel of the drop down as per selection.


// Code section 3 : Contains Code for 2 Web Forms (HTML Mark Up and Code Behind) with Tables and Stored Procedure.
//Tables and Stored Procedure
-- Countries Table
CREATE TABLE [dbo].[Countries](
 [CountryID] [int] IDENTITY(1,1) NOT NULL,
 [Countries] [varchar](25) NULL
) 

            -- Table for States
create table States
(
StateID int identity(1,1),
States varchar(25)
)


-- Proc to Get Countries
create proc GetCountriesList
as
begin
select * from Countries
end

-- Proc to Get States
create proc GetStates
as
begin
select * from States
end
//HTML Mark Up and Code Behind for Page 1
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="GoogleTranslator.aspx.cs" Inherits="GoogleTranslator" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="font-family: 'Cooper Black'; font-size: x-large; text-align: center;">
        Language Translating of WebSite<br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
            <Columns>
                <asp:BoundField DataField="Countries" HeaderText="Countries" />
            </Columns>

        </asp:GridView><br /><br />
        <asp:HyperLink ID="HyperLink1" NavigateUrl="~/GoogleTranslator2.aspx" runat="server">Next</asp:HyperLink>
        

    </div>
</asp:Content> 
//Code Behind for Page 1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class GoogleTranslator : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        BindGrid();
    }

    private void BindGrid()
    {
        try
        {
            // Function to bind the data to Grid.
            SqlConnection con = new SqlConnection("Data Source=AG-KKC;Initial Catalog=DNF;Persist Security Info=True;User ID=sa;Password=sqluser");
            con.Open();
            SqlCommand getcontent = new SqlCommand("GetCountriesList", con);
            getcontent.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter(getcontent);
            DataSet ds = new DataSet();
            da.Fill(ds);
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
        catch (Exception ex)
        {

        }
    }
}
HTML Mark up and Code Behind for Page 2
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="GoogleTranslator2.aspx.cs" Inherits="GoogleTranslator2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div style="font-family: 'Cooper Black'; font-size: x-large; text-align: center;" align="center">
        Language Translating of WebSite<br />
        <br />
        <div align="center">
         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
            <Columns>
                <asp:BoundField DataField="States" HeaderText="States" />
            </Columns>

        </asp:GridView>
        </div>
       

    </div>
</asp:Content>

Code Behind for Page 2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class GoogleTranslator2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindGrid();
        }
    }

    private void BindGrid()
    {
        try
        {
            // Function to bind the data to Grid.
            SqlConnection con = new SqlConnection("Data Source=AG-KKC;Initial Catalog=DNF;Persist Security Info=True;User ID=sa;Password=sqluser");
            con.Open();
            SqlCommand getcontent = new SqlCommand("GetStates", con);
            getcontent.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter(getcontent);
            DataSet ds = new DataSet();
            da.Fill(ds);
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
        catch (Exception ex)
        {

        }
    }
}

The reason for showing 2 pages is that once you navigate to another page you dont have to select the language again for translation Google does it automatically

OutPut for Page 1 : Showing Default Language English



Selecting Language for Translation : Hindi



Translated Page : Hindi Language



Moving to Next Page : Language Still same as per user preference




Note :- Please go through the Terms of Service of Google to know about more use age.

Link :- http://www.google.com/intl/en/policies/terms/


Conclusion


Note  :- To use this service while you are developing you need to be connected to internet and you will not see the drop down of languages in the design mode.It only shows up dynamically when you run the application.

Reference


https://translate.google.com/manager/website/

Thursday, December 26, 2013

Example of AJAX Control




AnimationExtender control
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ACT" %>



<ACT:AnimationExtender ID="AnimationExtender1" runat="server" TargetControlID="txtDescription">
                        <Animations>
                   <OnLoad>
                      <Sequence>
                         <Pulse Duration="0.5" Iterations="0" />
                      </Sequence>
                   </OnLoad>
                </Animations>
                        </ACT:AnimationExtender>

ValidatorCalloutExtender


<asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine"></asp:TextBox>
                    <asp:RequiredFieldValidator CssClass="Validation" ID="RequiredFieldValidatorDescription" runat="server" ErrorMessage="Description Required" ControlToValidate="txtDescription" ValidationGroup="submit"></asp:RequiredFieldValidator>
                        <ACT:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="RequiredFieldValidatorDescription">
                        </ACT:ValidatorCalloutExtender>



HtmlEditorExtender


<ACT:HtmlEditorExtender ID="HtmlEditorExtender1" runat="server" TargetControlID="txtDescription">
                        </ACT:HtmlEditorExtender>


SliderExtender


<body>
    <form id="form1" runat="server">
    <div>
        <cc2:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </cc2:ToolkitScriptManager>
        <script type="text/javascript">
            function pageLoad(sender, e) {
                var obj = $find("<%=sliderVolume.ClientID %>");
                obj.add_valueChanged(function () {
                    SetV(obj.get_Value());
                });
            }
            function SetV(VolumeValue) {
                ASPNetMedia.Audio('<%=Audio1.ClientID %>').SetVolume(VolumeValue);
            }


        </script>
        <asp:TextBox ID="TextBox2" runat="server" Width="80" Visible="true"></asp:TextBox>
        <asp:TextBox ID="TextBox1" runat="server"
            Text="50"></asp:TextBox>
        <cc2:SliderExtender ID="sliderVolume" runat="server" Maximum="100" Minimum="0" TargetControlID="TextBox1"
            Orientation="Horizontal" RaiseChangeOnlyOnMouseUp="False" Length="100" BoundControlID="TextBox2">
        </cc2:SliderExtender>
    </div>
    </form>
</body>

RoundedCornersExtender

<ACT:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" TargetControlID="txtDescription" Radius="20" Corners="All" Color="Cornsilk">
                        </ACT:RoundedCornersExtender>


ColorPickerExtender

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ColorPicker.aspx.cs" Inherits="ColorPicker" %>



<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 <script runat="server"> 

      

</script>

<script type="text/javascript">

    function selectedColorChanged(sender) {

        sender.get_element().style.color = "#" + sender.get_selectedColor();

        sender.get_element().style.backgroundColor = "#" + sender.get_selectedColor();

        document.getElementById('Label1').style.color = "#" + sender.get_selectedColor();

    } 

</script>

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

    <title></title>



</head>

<body>

    <form id="form1" runat="server">

    <div>

    <h2 style="color:blue; font-style:italic;">Ajax ColorPickerExtender Example: How To Use PopupButtonID</h2> 

        <hr width="600" align="left" color="LightBlue" /> 

        <asp:ScriptManager  

            ID="ScriptManager1" 

            runat="server" 

            > 

        </asp:ScriptManager> 

        <br /><br /> 

        <asp:Label  

            ID="Label1" 

            runat="server" 

            Text="click here to cahnge text color." 

            Font-Size="XX-Large" 

            Font-Names="Comic Sans MS" 

            ForeColor="purple" 

            > 

        </asp:Label> 

   

       

        <asp:TextBox ID="TextBox1" runat="server"  Height="18px" Width="20px"  BackColor="purple" ForeColor="purple"></asp:TextBox>

        <asp:ColorPickerExtender ID="TextBox1_ColorPickerExtender" runat="server"

            Enabled="True" TargetControlID="TextBox1" OnClientColorSelectionChanged="selectedColorChanged">

        </asp:ColorPickerExtender>

      

    </form>

</body>

</html>

ResizableControlExtender

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 <script runat="server"> 

      

</script>
<style type="text/css">
.handlecss
{
width:20px;
height:20px;
background-color:Red ;
}
.resizablecss
{
padding:0px;
border-style:solid;
border-width:2px;
border-color:Green;
cursor:se-resize;
}
    </style>
<div>
        <asp:Panel ID="Panel1" runat="server" Height="202px" Width="817px">
        <p  style="font-family:Verdana; color:Green; font-size:15">This is example of ResizableControlExtender. This is example of ResizableControlExtender. This is example of
        ResizableControlExtender.
        This is example of ResizableControlExtender.</p>
        <p style="font-family:Verdana; color:Green; font-size:15"> This is example of ResizableControlExtender. This is example of ResizableControlExtender.
        This is example of ResizableControlExtender. This is example of ResizableControlExtender. </p>
        <p style="font-family:Verdana; color:Green; font-size:15"> This is example of ResizableControlExtender.
        This is example of ResizableControlExtender. This is example of ResizableControlExtender. This is example of ResizableControlExtender.
        </p>
        </asp:Panel>
       <asp:ResizableControlExtender ID="ResizableControlExtender1" TargetControlID="Panel1" HandleCssClass="handlecss" ResizableCssClass="resizablecss" MaximumHeight="700" MaximumWidth="700"
       MinimumHeight="300" MinimumWidth="200" HandleOffsetX="2" HandleOffsetY="2"  runat="server">
        </asp:ResizableControlExtender>
    </div>


MaskedEditValidator MaskedEditExtender



<asp:TextBox ID="TextBox11" runat="server" ReadOnly="True" Height="20px" Width="255px" class="txt"></asp:TextBox>
                           <asp:MaskedEditValidator ID="MaskedEditValidator2" runat="server" ControlExtender="MaskedEditExtender2"
                               ControlToValidate="TextBox11" Display="Dynamic" EmptyValueMessage="date is Required"
                               InvalidValueMessage="date is Invalid" IsValidEmpty="False" TooltipMessage="Please Enter Admission date of Student">
                           </asp:MaskedEditValidator>
                           <asp:CalendarExtender ID="CalendarExtender1" TargetControlID="TextBox11" runat="server">
                           </asp:CalendarExtender>
                           <asp:MaskedEditExtender ID="MaskedEditExtender2" runat="server" Mask="99/99/9999"
                               MaskType="Date" TargetControlID="TextBox11">
                           </asp:MaskedEditExtender>

ConfirmButtonExtender
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
                           <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <asp: ID="ConfirmButtonExtender1" runat="server" ConfirmOnFormSubmit="True" ConfirmText="Are you Sure?" TargetControlID="Button1" ></asp:ConfirmButtonExtender>

BalloonPopupExtender

<asp:Label runat="server" ID="lbl1_2" Text="I am a label"></asp:Label>
                                <asp:Panel runat="server" ID="pnl1_2" Enabled="false">
                                    This is some random text for display purpose.
                                </asp:Panel>
                                <asp:BalloonPopupExtender ID="BalloonPopupExtender1" runat="server"
                                TargetControlID="lbl1_2"
                                BalloonPopupControlID="pnl1_2"
                                Position="BottomRight"
                                BalloonStyle="Rectangle"
                                BalloonSize="Medium"
                                UseShadow="true"
                                ScrollBars="Auto"
                                DisplayOnMouseOver="true"
                               
                                DisplayOnFocus="false"
                                DisplayOnClick="false" />

AlwaysVisibleControlExtender

<div >
        <asp:ToolkitScriptManager ID="Sc1" runat="server">
        </asp:ToolkitScriptManager>
       
        <asp:Label ID="Label3" runat="server" Text="Line : 1"></asp:Label>
        <br />
        <br />
        <asp:Label ID="Label4" runat="server" Text="Line : 2"></asp:Label>
        <br />
        <br />
        <asp:Label ID="Label5" runat="server" Text="Line : 3"></asp:Label>
        <br /><br />
        <asp:Label ID="Label6" runat="server" Text="Line : 4"></asp:Label>
        <br /><br />
        <asp:Label ID="Label7" runat="server" Text="Line : 5"></asp:Label>
        <br /><br />
        <asp:Label ID="Label8" runat="server" Text="Line : 6"></asp:Label>
        <br /><br />
        <asp:Label ID="Label9" runat="server" Text="Line : 7"></asp:Label>
        <br /><br />
        <asp:Label ID="Label10" runat="server" Text="Line : 8"></asp:Label>
        <br /><br />
        <asp:Label ID="Label11" runat="server" Text="Line : 9"></asp:Label>
        <br /><br />
        <asp:Label ID="Label12" runat="server" Text="Line : 10"></asp:Label>
        <br /><br />
        <asp:Label ID="Label13" runat="server" Text="Line : 11"></asp:Label>
        <br /><br />
        <asp:Label ID="Label14" runat="server" Text="Line : 12"></asp:Label>       
        <br /><br />
        <asp:Label ID="Label15" runat="server" Text="Line : 13"></asp:Label>
        <br /><br />
        <asp:Label ID="Label16" runat="server" Text="Line : 14"></asp:Label>
        <br /><br />
        <asp:Label ID="Label17" runat="server" Text="Line : 15"></asp:Label>
        <br /><br />
        <asp:Label ID="Label18" runat="server" Text="Line : 16"></asp:Label>
        <br /><br />
        <asp:Label ID="Label19" runat="server" Text="Line : 17"></asp:Label>
        <br /><br />
        <asp:Label ID="Label20" runat="server" Text="Line : 18"></asp:Label>
        <br /><br />
        <asp:Label ID="Label21" runat="server" Text="Line : 18"></asp:Label>
        <br /><br />
        <asp:Label ID="Label22" runat="server" Text="Line : 20"></asp:Label>
        <br /><br />
        <asp:Label ID="Label23" runat="server" Text="Line : 21"></asp:Label>
        <br /><br />
        <asp:Label ID="Label24" runat="server" Text="Line : 22"></asp:Label>
        <br /><br />
        <asp:Label ID="Label25" runat="server" Text="Line : 23"></asp:Label>
        <br /><br />
        <asp:Label ID="Label26" runat="server" Text="Line : 24"></asp:Label>
        <br /><br />
        <asp:Label ID="Label27" runat="server" Text="Line : 25"></asp:Label>
        <br /><br />
        <asp:Label ID="Label28" runat="server" Text="Line : 26"></asp:Label>
        <br /><br />
        <asp:Label ID="Label29" runat="server" Text="Line : 27"></asp:Label>
        <br /><br />
        <asp:Label ID="Label30" runat="server" Text="Line : 28"></asp:Label>
        <br /><br />
        <asp:Label ID="Label31" runat="server" Text="Line : 29"></asp:Label>
        <br /><br />
        <asp:Label ID="Label32" runat="server" Text="Line : 30"></asp:Label>
        <br /><br />
        <asp:Label ID="Label33" runat="server" Text="Line : 31"></asp:Label>
        <br /><br />
        <asp:Label ID="Label34" runat="server" Text="Line : 32"></asp:Label>
        <br /><br />
        <asp:Label ID="Label35" runat="server" Text="Line : 33"></asp:Label>
        <br /><br />
        <asp:Label ID="Label36" runat="server" Text="Line : 34"></asp:Label>
        <br /><br />
        <asp:Label ID="Label37" runat="server" Text="Line : 35"></asp:Label>
        <br /><br />
       
       
        <asp:Panel ID="panel2" runat="server" BorderColor="Red" BorderStyle="Solid"
            BorderWidth="2px" Height="200px" Width="200px" >
            <asp:Label ID="lblMsg" runat="server"
            Text="
            THIS PANEL IS ALWAYS VISIBLE
            EVEN WHEN USER SCROLLS OR RESIZES THE WINDOW" Font-Italic="False"
                ForeColor="Blue"></asp:Label>
            <br /> <br />
            <asp:Button id="btnSubmit" runat="server" Text="Submit" />
        </asp:Panel>
        <br />
        <asp:AlwaysVisibleControlExtender
             ID="AlwaysVisibleControl1" TargetControlID="Panel1" runat="server"
             HorizontalOffset="20" VerticalOffset="20" HorizontalSide="Right"
             VerticalSide="Top">
        </asp:AlwaysVisibleControlExtender>
       
    </div>

TextBoxWatermarkExtender

<asp:TextBoxWatermarkExtender ID="watermark" runat="server" TargetControlID="txtName" WatermarkText="Type name here..." />
<asp:TextBox ID="txtName" runat="server" />