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. Avoiding Button Double Click (DropDownList)

Avoiding Button Double Click (DropDownList)

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestion
2 Posts 2 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.
  • K Offline
    K Offline
    Karan_TN
    wrote on last edited by
    #1

    private void checkButtonDoubleClick(Button button)
    {
    System.Text.StringBuilder sbValid = new System.Text.StringBuilder();
    sbValid.Append("if (typeof(Page_ClientValidate) == 'function') { ");
    sbValid.Append("if (Page_ClientValidate() == false) { return false; }} ");
    sbValid.Append("this.value = 'Please wait...';");
    sbValid.Append("this.disabled = true;");
    sbValid.Append(this.Page.ClientScript.GetPostBackEventReference(button, ""));
    sbValid.Append(";");
    button.Attributes.Add("onclick", sbValid.ToString());
    }

    the above coding avoid double click for an button.. also the same i would like to apply for an dropdownlist. because according to the selection of dropdown value, i m changing the button textvalue. according to the text value i m calling different functions.so when user select the dropdownlist item, it take some time. during that time, user should not click the button obviously. so i want to disable the button while user selecting item from dropdownlist until the text changes. how to achieve it? help me - KARAN

    S 1 Reply Last reply
    0
    • K Karan_TN

      private void checkButtonDoubleClick(Button button)
      {
      System.Text.StringBuilder sbValid = new System.Text.StringBuilder();
      sbValid.Append("if (typeof(Page_ClientValidate) == 'function') { ");
      sbValid.Append("if (Page_ClientValidate() == false) { return false; }} ");
      sbValid.Append("this.value = 'Please wait...';");
      sbValid.Append("this.disabled = true;");
      sbValid.Append(this.Page.ClientScript.GetPostBackEventReference(button, ""));
      sbValid.Append(";");
      button.Attributes.Add("onclick", sbValid.ToString());
      }

      the above coding avoid double click for an button.. also the same i would like to apply for an dropdownlist. because according to the selection of dropdown value, i m changing the button textvalue. according to the text value i m calling different functions.so when user select the dropdownlist item, it take some time. during that time, user should not click the button obviously. so i want to disable the button while user selecting item from dropdownlist until the text changes. how to achieve it? help me - KARAN

      S Offline
      S Offline
      Sandeep Mewara
      wrote on last edited by
      #2

      Karan_TN wrote:

      so i want to disable the button while user selecting item from dropdownlist until the text changes.

      If doing all the stuff client side then: Attach a javascript function to Dropdownlist items or to Dropdown change event. In that JS function, just disable the button. Once you are ready with all the stuff, enable it back (like while calling different function) If doing all the stuff server side then: In selectedindex change event, disable the button. After you have worked on other functions, at the end enable the button.

      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