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. button disable

button disable

Scheduled Pinned Locked Moved ASP.NET
tutorial
10 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.
  • Y Offline
    Y Offline
    ybasha
    wrote on last edited by
    #1

    hi there, i need to know how to disable button when page load and should be enable once the user keyin the textbox. any sample code will be appreciated. regards Ybasha

    V 1 Reply Last reply
    0
    • Y ybasha

      hi there, i need to know how to disable button when page load and should be enable once the user keyin the textbox. any sample code will be appreciated. regards Ybasha

      V Offline
      V Offline
      varshavmane
      wrote on last edited by
      #2

      Write Javascript function on textbox focus.

      Y 1 Reply Last reply
      0
      • V varshavmane

        Write Javascript function on textbox focus.

        Y Offline
        Y Offline
        ybasha
        wrote on last edited by
        #3

        ha ha ha very funny dont u think i dont know that, am looking for script sample code. i tried the below one not working. btnSubmit.Attributes.Add("onclick", "this.disabled=true;" + GetPostBackEventReference(btnSubmit).ToString());

        V 1 Reply Last reply
        0
        • Y ybasha

          ha ha ha very funny dont u think i dont know that, am looking for script sample code. i tried the below one not working. btnSubmit.Attributes.Add("onclick", "this.disabled=true;" + GetPostBackEventReference(btnSubmit).ToString());

          V Offline
          V Offline
          varshavmane
          wrote on last edited by
          #4

          Very Good but as u said u want to make it enable when user keyin in textbox then why r u adding javascript code on button??? Try to Textbox1.Attributes.Add("onfocus", "GetEnable();"); and function GetEnable() { document.getclientElementID("Button1").disable = false; } Just check the syntax...

          Y 1 Reply Last reply
          0
          • V varshavmane

            Very Good but as u said u want to make it enable when user keyin in textbox then why r u adding javascript code on button??? Try to Textbox1.Attributes.Add("onfocus", "GetEnable();"); and function GetEnable() { document.getclientElementID("Button1").disable = false; } Just check the syntax...

            Y Offline
            Y Offline
            ybasha
            wrote on last edited by
            #5

            hi thanks for the code but the function GetEnable() { document.getclientElementID("Button1").disable = false; } is not working.....am using VS2003... document.getclientElementID is not working

            V P 2 Replies Last reply
            0
            • Y ybasha

              hi thanks for the code but the function GetEnable() { document.getclientElementID("Button1").disable = false; } is not working.....am using VS2003... document.getclientElementID is not working

              V Offline
              V Offline
              varshavmane
              wrote on last edited by
              #6

              Have u tried this: document.getElementById("Button1").disable = false;

              Y 1 Reply Last reply
              0
              • Y ybasha

                hi thanks for the code but the function GetEnable() { document.getclientElementID("Button1").disable = false; } is not working.....am using VS2003... document.getclientElementID is not working

                P Offline
                P Offline
                Piyush Vardhan Singh
                wrote on last edited by
                #7

                which browser u use

                Piyush Vardhan Singh Senior Software Engineer TAS NewDelhi India

                Y 1 Reply Last reply
                0
                • P Piyush Vardhan Singh

                  which browser u use

                  Piyush Vardhan Singh Senior Software Engineer TAS NewDelhi India

                  Y Offline
                  Y Offline
                  ybasha
                  wrote on last edited by
                  #8

                  IE 6.0

                  1 Reply Last reply
                  0
                  • V varshavmane

                    Have u tried this: document.getElementById("Button1").disable = false;

                    Y Offline
                    Y Offline
                    ybasha
                    wrote on last edited by
                    #9

                    hi there, Thanks for the support but the script "document.getElementById("Button1").disable = false;" was not working so i have created a textchange event it working fine now. private void textbox_TextChanged(object sender, System.EventArgs e) { Button.Enabled = true; } regards ybasha

                    V 1 Reply Last reply
                    0
                    • Y ybasha

                      hi there, Thanks for the support but the script "document.getElementById("Button1").disable = false;" was not working so i have created a textchange event it working fine now. private void textbox_TextChanged(object sender, System.EventArgs e) { Button.Enabled = true; } regards ybasha

                      V Offline
                      V Offline
                      varshavmane
                      wrote on last edited by
                      #10

                      It should work as its working on my m/c, just whether ur browser support javscript???

                      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