TextBox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • murugavelmsc
    New Member
    • Apr 2008
    • 54

    TextBox

    Hi,

    In asp.net, I have a form of user name and Password textbox control and i set in the username textboxes as "Enter Username" and in passord textbox as Enter Password" whenever i focus into username textbox the text to be cleared . how to do this.

    thanks in advance,

    bye murugavel
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi,

    You could use the Javascript event OnFocus to fire a function which sets the contents of your textbox to "".

    Hope this helps,

    Dr B

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      Originally posted by murugavelmsc
      Hi,

      In asp.net, I have a form of user name and Password textbox control and i set in the username textboxes as "Enter Username" and in passord textbox as Enter Password" whenever i focus into username textbox the text to be cleared . how to do this.

      thanks in advance,

      bye murugavel
      If you are using Framework 3.5 you can wrap them in an update panel, and use regular code (c#/vb) to clear the text boxes. That will generate AJAX to update the page asynchronously.

      Otherwise, you will have to use client-side Javascript.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Originally posted by DrBunchman
        Hi,

        You could use the Javascript event OnFocus to fire a function which sets the contents of your textbox to "".

        Hope this helps,

        Dr B
        This is a great suggestion and will work in solving your problem.
        If you are using Ajax in your website you could the Ajax Toolkit's TextBoxWatermar k to do this for you.

        -Frinny

        Comment

        Working...