Reputation: 3272
I am developing small web application
in which I am having one button which is used for editing and named ButtonEdit.
I am setting this button Enabled=false
at design time so, when the page is rendered the button is disabled.
Now when the checkbox is checked I am making the button enabled using javascript
.
I used following code.
document.getElementById("ButtonEdit").disabled=false;
And this code works fine and makes my button enabled.
But when i click on edit button i want to fire some javascript event which is not fired.
I am having proper code in my form written with onClientClick=function()
.
But i think as the control is disabled from server side it will not call any event and script.
How can i resolve this problem?
Upvotes: 1
Views: 894
Reputation: 106
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("Clicked!");
}
Upvotes: 0
Reputation: 20024
Try this:
<asp:Button disabled="disabled" ID="myButton" ClientIDMode="Static"
Enabled="false" OnClientClick="return someFunction();" runat="server" Text="Save" />
And then on the client side:
document.getElementById('myButton').removeAttribute('disabled'); //or jquery alternative
Upvotes: 1