Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to disable default button in asp.net
Posted

We can't get what default button means.

You can set the Visibility is false. This will Hide the Button from the Page.

or

button.enabled = false;

write this code in required function or Page load event.
 
Share this answer
 
I dont know what do you mean by default button,but you can disable button something as follows:

Button definition:
<asp:button id="btn" runat="server" text="Redirect" />

In Code Behind:
btn.Attributes.Add("onclick","return Redirectfunc();");

Write the following function in the head section of your page:
C#
function Redirectfunc()
{
  document.getElementById('btn').disabled = true;
  window.location.href="http://www.google.com"; 
  return true;
}


Regards.. :laugh:
 
Share this answer
 
<asp:button id="btn" runat="server" text="Redirect" enabled="false" />
 
Share this answer
 
v2
I think this is wat u are looking for..
button1.Enabled=false;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900