Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. textbox events

textbox events

Scheduled Pinned Locked Moved ASP.NET
question
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Soumini Ramakrishnan
    wrote on last edited by
    #1

    I need a textbox which displays some message, say "Enter Text". When someone clicks on it that message should be cleared and should be ready to enter some other text. Which event of the textbox should I use for it?

    R P N V S 5 Replies Last reply
    0
    • S Soumini Ramakrishnan

      I need a textbox which displays some message, say "Enter Text". When someone clicks on it that message should be cleared and should be ready to enter some other text. Which event of the textbox should I use for it?

      R Offline
      R Offline
      rahul net11
      wrote on last edited by
      #2

      You can use javascript on that. Onblur event of textbox you can clear textbox value.

      People Laugh on me Because i am Different but i Laugh on them Because they all are same.

      1 Reply Last reply
      0
      • S Soumini Ramakrishnan

        I need a textbox which displays some message, say "Enter Text". When someone clicks on it that message should be cleared and should be ready to enter some other text. Which event of the textbox should I use for it?

        P Offline
        P Offline
        pmarfleet
        wrote on last edited by
        #3

        Use the Javascript onclick event **Paul Marfleet** _"No, his mind is not for rent To any God or government" **Tom Sawyer - Rush**_

        1 Reply Last reply
        0
        • S Soumini Ramakrishnan

          I need a textbox which displays some message, say "Enter Text". When someone clicks on it that message should be cleared and should be ready to enter some other text. Which event of the textbox should I use for it?

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          OnClick JS event

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

          1 Reply Last reply
          0
          • S Soumini Ramakrishnan

            I need a textbox which displays some message, say "Enter Text". When someone clicks on it that message should be cleared and should be ready to enter some other text. Which event of the textbox should I use for it?

            V Offline
            V Offline
            Vimal Raj
            wrote on last edited by
            #5

            Hi, It is better to use a client side script for this.You can use the following javascript code and call the same in the OnFocus event of the textbox. Insert this js in the aspx page in a script tag. function clearText(txtId) { if(document.getElementById(txtId).value=="Enter Text") { document.getElementById(txtId).value=""; } } And add this code to the codebehind file. TextBox1.Attributes.Add("OnFocus", "clearText('" + TextBox1.ClientID + "')"); Do let me know if you need more info. Cheers...

            Happy Programming, Vimal Raj MCAD.Net www.techisolutions.blogspot.com

            1 Reply Last reply
            0
            • S Soumini Ramakrishnan

              I need a textbox which displays some message, say "Enter Text". When someone clicks on it that message should be cleared and should be ready to enter some other text. Which event of the textbox should I use for it?

              S Offline
              S Offline
              Soumini Ramakrishnan
              wrote on last edited by
              #6

              But if I want to use that textbox within update panel?

              V 1 Reply Last reply
              0
              • S Soumini Ramakrishnan

                But if I want to use that textbox within update panel?

                V Offline
                V Offline
                Vimal Raj
                wrote on last edited by
                #7

                Hi, Have you tried the code which i gave in the last post. It can be used even if you are using an update panel. do let me know if you are getting any errors. Cheers...

                Happy Programming, Vimal Raj MCAD.Net www.techisolutions.blogspot.com

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups