One time only clickable button

The magic about a one time clickable button in C# is to override Button and place the default onclick event to aspnet_onclick and add another function to onclick that disables the button if Page_IsValid. I will not post the whole solution, but I will share the javascript that enable the disable effect.

function SubmitButton_InitOnClick( id, className )
{
var sb = document.getElementsByName(id)[0];
sb.aspnet_onclick = sb.onclick;
sb.button_className = className;
sb.onclick = SubmitButton_Click;
}

Even if it is a good solution it does not work well with updatepanels because the buttons are rebinded. Thats a topic i have not yet solved. Please tell me if you have a solution to this problem.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

0 Response to “One time only clickable button”


  • No Comments

Leave a Reply