6

Need for a workaround for SetEnabled (false) stopping e.processOnServer with the...

 2 years ago
source link: https://www.codesd.com/item/need-for-a-workaround-for-setenabled-false-stopping-e-processonserver-with-the-devexpress-button.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Need for a workaround for SetEnabled (false) stopping e.processOnServer with the DevExpress button

advertisements

I am using a DevExpress ASPxButton on a webpage of mine, and need a way to stop the user from being able to double click the button. My initial thought was to try:

    function OnClick(s, e) {
        s.SetEnabled(false);
        e.processOnServer;
    }

Unfortunately, I found out DevExpress stops all server side events from firing when you disable a button. So I went ahead and did some googling and ended up on the DevExpress website (which can be infuriatingly unhelpful sometimes) which gave an official "work around" which they reference in the other help threads on their site regarding this issue. Here is the link for reference.

for anyone unwilling to click the link, they recommended this:

    var buttonClicked = false;
    function MyBtnClick(s,e){
        if(buttonClicked) return;
        buttonClicked = true;
        // do something
    }

which I turned into:

    var buttonClicked = false;
    function OnClick(s, e) {
        if (buttonClicked) return;
        buttonClicked = true;
        e.processOnServer;
    }

At first I thought this was working, but then realized it worked for a double click, but if the user were to click a third time, it just went ahead and processed again. For what should be an easy task, I seem to be having a hard time with this one (granted I am relatively new to JavaScript, so maybe the answer is obvious). If anyone knows of a way to disable the button after the first click while still allowing it to process on the server the first time, it would be appreciated.


I searched for some options for your issue, if you can check the links below :

http://www.devexpress.com/Support/Center/Question/Details/Q438771

http://www.devexpress.com/Support/Center/Question/Details/Q273711

http://www.devexpress.com/Support/Center/Question/Details/B132082


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK