Monday, May 7, 2012

JS(Prevent page from multiple clicks ASP.NET)




//Step:01 Write This into Header

<script type="text/javascript">
      function ClientSideClick(myButton) {
      // Client side validation
      if (typeof (Page_ClientValidate) == 'function') {
          if (Page_ClientValidate() == false)
          { return false; }
      }

      //make sure the button is not of type "submit" but "button"
      if (myButton.getAttribute('type') == 'button') {
              // diable the button
              myButton.disabled = true;
              myButton.className = "btn-inactive";
              myButton.value = "processing...";
          }
          return true;
      }
</script>



//Step:02 Write this on the Page_Load Event
Page.GetPostBackEventReference(Control_Here);



No comments:

Post a Comment