0
I have the following Asp button:
<asp:Button ID="btnOk" runat="server" AutoPostBack="true" CausesValidation="true" ClientIDMode="Static" Text="Ok" Width="80px" OnClick="btnOk_Click" OnClientClick="btnOk_OnClick();return true;" class="dxbButton_Glass dxbButtonHover_Glass"></asp:Button>
And the following script:
function btnOk_OnClick() {
$("#btnOk").prop("disabled", true);
}
The event on the server:
protected void btnOk_Click(object sender, EventArgs e)
{
new Processar();
((Button)sender).Enabled = true;
}
The idea here is that the button is disabled since processing it takes time, but when I disable the button in java script, the button click does not post, so the btnOk_Click event does not run.
Do you have a solution? Thank you.
who denied the answer could at least have the education to explain the reason.
– Ricardo Pontual
I said no, Ricardo. For the simple reason of the loss of navigability - or the unnecessary use of resources. You will force the button to be disabled even when the user changes pages, for example. It might work, but I couldn’t find a good solution and I was negative.. But I am not the owner of the truth, what matters is the friend Gabriel Reis have the problem solved. EDIT: I’ll take the negative.. I think that the answers should not be judged by opinions, but by functionalities. As it solves the problem in question, I will remove the
-1
.– Marllon Nasser
No problem the negative, I just think I missed explain, for if you have any problem try not to repeat. Thank you.
– Ricardo Pontual