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. Disable a button a web form.

Disable a button a web form.

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
9 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.
  • A Offline
    A Offline
    AndieDu
    wrote on last edited by
    #1

    Hi All, My senario is: once a user clicks a button on web form, say Save, how can i disable this button to prevent user click it again. Because this is a web form, so this one: btnSave.Enable = false wasn't working unitl the web fom refreshs, but i just want this button to be disable as soon as the user clicks it. could someone in here guide me or point me to the right direction as i am struggling to get this work long time already. Thanks heaps.

    J K R T 4 Replies Last reply
    0
    • A AndieDu

      Hi All, My senario is: once a user clicks a button on web form, say Save, how can i disable this button to prevent user click it again. Because this is a web form, so this one: btnSave.Enable = false wasn't working unitl the web fom refreshs, but i just want this button to be disable as soon as the user clicks it. could someone in here guide me or point me to the right direction as i am struggling to get this work long time already. Thanks heaps.

      J Offline
      J Offline
      johnsontroye
      wrote on last edited by
      #2

      use javascript to disable the button. www.anothercodesite.com/blog

      1 Reply Last reply
      0
      • A AndieDu

        Hi All, My senario is: once a user clicks a button on web form, say Save, how can i disable this button to prevent user click it again. Because this is a web form, so this one: btnSave.Enable = false wasn't working unitl the web fom refreshs, but i just want this button to be disable as soon as the user clicks it. could someone in here guide me or point me to the right direction as i am struggling to get this work long time already. Thanks heaps.

        K Offline
        K Offline
        kumar_k508
        wrote on last edited by
        #3

        Hi, In the button click event you can write the btnsave.enable=false as a first line ,or else you can do it by using the javascript also ....

        S Kumar

        A 1 Reply Last reply
        0
        • A AndieDu

          Hi All, My senario is: once a user clicks a button on web form, say Save, how can i disable this button to prevent user click it again. Because this is a web form, so this one: btnSave.Enable = false wasn't working unitl the web fom refreshs, but i just want this button to be disable as soon as the user clicks it. could someone in here guide me or point me to the right direction as i am struggling to get this work long time already. Thanks heaps.

          R Offline
          R Offline
          Rajdev Ramasamy
          wrote on last edited by
          #4

          Hi, Are you using UpdatePanel? Thanks, Rajdev KR

          A 1 Reply Last reply
          0
          • R Rajdev Ramasamy

            Hi, Are you using UpdatePanel? Thanks, Rajdev KR

            A Offline
            A Offline
            AndieDu
            wrote on last edited by
            #5

            sorry what do u mean...

            1 Reply Last reply
            0
            • K kumar_k508

              Hi, In the button click event you can write the btnsave.enable=false as a first line ,or else you can do it by using the javascript also ....

              S Kumar

              A Offline
              A Offline
              AndieDu
              wrote on last edited by
              #6

              this is a web form, not a windows form, what you said in here wont work....

              1 Reply Last reply
              0
              • A AndieDu

                Hi All, My senario is: once a user clicks a button on web form, say Save, how can i disable this button to prevent user click it again. Because this is a web form, so this one: btnSave.Enable = false wasn't working unitl the web fom refreshs, but i just want this button to be disable as soon as the user clicks it. could someone in here guide me or point me to the right direction as i am struggling to get this work long time already. Thanks heaps.

                T Offline
                T Offline
                therios
                wrote on last edited by
                #7

                I have done pretty much the same thing. I ended up using a little jscript. I call it with the "true" or "false" that I want the item to have.

                function applyvalidate(myenableflag) {
                document.all.validate.disabled = true;
                if (myenableflag == true) {
                document.all.validate.disabled = false;
                }
                if (myenableflag == false) {
                document.all.validate.enabled = false;
                }
                }

                The name of the button is "validate". I do this so that the person has to have a valid form (actively check with jscript) and when it is valid, the validate button lights up. they can then hit the validate button that provides a code for entry into a checklist. Then I light up the submit button. At anytime when the formcheck becomes invalid, i use the same functions to disable the buttons on the fly. Does that help?

                A 1 Reply Last reply
                0
                • T therios

                  I have done pretty much the same thing. I ended up using a little jscript. I call it with the "true" or "false" that I want the item to have.

                  function applyvalidate(myenableflag) {
                  document.all.validate.disabled = true;
                  if (myenableflag == true) {
                  document.all.validate.disabled = false;
                  }
                  if (myenableflag == false) {
                  document.all.validate.enabled = false;
                  }
                  }

                  The name of the button is "validate". I do this so that the person has to have a valid form (actively check with jscript) and when it is valid, the validate button lights up. they can then hit the validate button that provides a code for entry into a checklist. Then I light up the submit button. At anytime when the formcheck becomes invalid, i use the same functions to disable the buttons on the fly. Does that help?

                  A Offline
                  A Offline
                  AndieDu
                  wrote on last edited by
                  #8

                  ya it does help. thanks a lot.

                  T 1 Reply Last reply
                  0
                  • A AndieDu

                    ya it does help. thanks a lot.

                    T Offline
                    T Offline
                    therios
                    wrote on last edited by
                    #9

                    Glad it helped. I can't even remember how and where I stumbled across that... allowed me to do a TON of client side automation on forms. Probably NOT the best solution, but in specific areas, it works well...

                    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