Roman
Roman

Reputation: 63

How Disable ASPxButton after click to prevent double clicking using javascript on front code side?

The question is the same as I wrote in header: "How Disable ASPxButton after click to prevent double clicking using javascript on front code side?" In asp.net i can do this operation like this:

<asp:Button ID="btnSubmit" runat="server" Text="Submit"
OnClick="btnSubmit_Click"
UseSubmitBehavior="false"
OnClientClick="this.disabled='true'; this.value='Please wait..';"/>

and it works correctly. In Dev express i tried to do that similarly:

<dx:ASPxButton ID="btnSubmit" runat="server" Text="Submit"
OnClick="btnSubmit_Click"
UseSubmitBehavior="false">

<ClientSideEvents Click="this.disabled='true'; this.value='Please wait..';" />
</dx:ASPxButton>

but it doesnt work correctly.. What I'm doing wrong and how to fix it?

Upvotes: 1

Views: 1984

Answers (1)

David Pine
David Pine

Reputation: 24545

According to Dev Express:

https://www.devexpress.com/Support/Center/Question/Details/Q454635

Use the ASPxClientButton.SetEnabled method to disable the ASPxButton on the client side. Note, the SetEnabled method result is not sent to the server side when a request is performed. This means that the disabled/enabled state is not synchronized with the server-side object. If you want to synchronize disabled states between client and server sides, for example, you can use the ASPxHiddenField control, containing the disabled state and restore it on the server side.

Upvotes: 1

Related Questions