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. General Programming
  3. C#
  4. ASP.Net : Problem in Button.OnClientClick Property.

ASP.Net : Problem in Button.OnClientClick Property.

Scheduled Pinned Locked Moved C#
csharpjavascriptasp-nethelptutorial
5 Posts 4 Posters 9 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.
  • H Offline
    H Offline
    hdv212
    wrote on last edited by
    #1

    hi in my WebForm I have a label and textBox and button, i want when user click button,OnClientClick occure and set label.Text to "Please Wait ..." how to do that? Note : i want to use JavaScript to Execute this Action (Client Side). i wrote this code but when i click button, Nothing Occured : .... "OnClientClick"="_Wait();" function _Wait() { document.getElementById("Label13").Text = "Please Wait ..."; } thanks.

    F A D 3 Replies Last reply
    0
    • H hdv212

      hi in my WebForm I have a label and textBox and button, i want when user click button,OnClientClick occure and set label.Text to "Please Wait ..." how to do that? Note : i want to use JavaScript to Execute this Action (Client Side). i wrote this code but when i click button, Nothing Occured : .... "OnClientClick"="_Wait();" function _Wait() { document.getElementById("Label13").Text = "Please Wait ..."; } thanks.

      F Offline
      F Offline
      Frank Kerrigan
      wrote on last edited by
      #2

      You could use serveside code to do it insteed. But this will incur a roundtrip/postback to the server. If your posting back anyway you might as well use the serverside method.


      Blog Have I http:\\www.frankkerrigan.com

      1 Reply Last reply
      0
      • H hdv212

        hi in my WebForm I have a label and textBox and button, i want when user click button,OnClientClick occure and set label.Text to "Please Wait ..." how to do that? Note : i want to use JavaScript to Execute this Action (Client Side). i wrote this code but when i click button, Nothing Occured : .... "OnClientClick"="_Wait();" function _Wait() { document.getElementById("Label13").Text = "Please Wait ..."; } thanks.

        A Offline
        A Offline
        albCode
        wrote on last edited by
        #3

        hdv212 wrote:

        ... "OnClientClick"="_Wait();"

        It should be yourbuttonname.Attributes.Add("OnClick","_Wait()"); protected void yourbuttonname_Click(object sender, EventArgs e) { Label13.Text = TextBox1.Text; } Hope this helps


        "My advice to you is to get married. If you find a good wife, you will be happy; if not, you will become a philosopher." Socrates

        H 1 Reply Last reply
        0
        • A albCode

          hdv212 wrote:

          ... "OnClientClick"="_Wait();"

          It should be yourbuttonname.Attributes.Add("OnClick","_Wait()"); protected void yourbuttonname_Click(object sender, EventArgs e) { Label13.Text = TextBox1.Text; } Hope this helps


          "My advice to you is to get married. If you find a good wife, you will be happy; if not, you will become a philosopher." Socrates

          H Offline
          H Offline
          hdv212
          wrote on last edited by
          #4

          Thanks for reply but i want ti use JavaScript (ClientSide) For OnClientClick Attribute.

          1 Reply Last reply
          0
          • H hdv212

            hi in my WebForm I have a label and textBox and button, i want when user click button,OnClientClick occure and set label.Text to "Please Wait ..." how to do that? Note : i want to use JavaScript to Execute this Action (Client Side). i wrote this code but when i click button, Nothing Occured : .... "OnClientClick"="_Wait();" function _Wait() { document.getElementById("Label13").Text = "Please Wait ..."; } thanks.

            D Offline
            D Offline
            DavidNohejl
            wrote on last edited by
            #5

            Was that _Wait() function even called? Where is that script located? In head? Do you get any javascript errors in browser? Is that label's id really "Label13"? Could be as well someControl$ctrl00$Label13 or something...


            "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus

            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