Disable an asp.net button postback
asp.net, javascript, postback, webforms
Solution
Use `OnClientClick="return false;"` to disabled postback. You can try this
<asp:button runat="server".... OnClientClick="return false;" />
In C# you can disable button by
btnUnlock.IsEnabled = false;
IsEnabled Property MSDN link
Problem
I tried to disable an asp.net button but failed. The error: ``` Compiler Error Message: CS1501: No overload for method 'btnUnlock_Click' takes '0' arguments ``` Source Error: ``` Line 99: <asp:Button ID="btnUnlock" runat="server" Text="Unlock User" Visible="False" OnClick ="btnUnlock_Click()" /> ``` And ``` protected void btnUnlock_Click(object sender, EventArgs e) { MembershipUser user = Membership.GetUser(userName); user.UnlockUser(); } ``` Thanks.