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. How to add onclick event to label and Textbox in Asp.net?

How to add onclick event to label and Textbox in Asp.net?

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelptutorialquestion
3 Posts 3 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.
  • M Offline
    M Offline
    mdrizwan_1
    wrote on last edited by
    #1

    Hello, Anybody can explain me how to create onclick event for label and textbox in Asp.net ? because i have some task to be achieved on click event of textbox and label control? Please help or provide any alternate solution? Regards

    D B 2 Replies Last reply
    0
    • M mdrizwan_1

      Hello, Anybody can explain me how to create onclick event for label and textbox in Asp.net ? because i have some task to be achieved on click event of textbox and label control? Please help or provide any alternate solution? Regards

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      Have a look into the Javascript events available. You can have a click event there and handle it in javascript.

      "No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem

      1 Reply Last reply
      0
      • M mdrizwan_1

        Hello, Anybody can explain me how to create onclick event for label and textbox in Asp.net ? because i have some task to be achieved on click event of textbox and label control? Please help or provide any alternate solution? Regards

        B Offline
        B Offline
        Brij
        wrote on last edited by
        #3

        you can attach onclick event on label and textbox at server side as below

        Label1.Attributes.Add("onclick", "javascript:alert('you have pressed Label')");
        TextBox1.Attributes.Add("onclick", "javascript:alert('you have pressed Textbox')");

        Cheers!! Brij

        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