How to disable a button in


If you want to disable button after click on button in, then following syntax will help you. In this a JavaScript disable function is added dynamically to button on load. So that now if you click first time it works and after this it will disable. Here we are using add function in which first parameter we are passing is the on click event and other is the parameter contains the disabling JavaScript syntax which will disable your button.

 C# |  copy code |? 
  protected void Page_Load(object sender, EventArgs e)
        Button1.Attributes.Add("onclick", "this.disabled=true;");

Leave a Comment

Your email address will not be published.