本文介绍了需要解决方法SetEnabled(false)使用DevExpress按钮停止e.processOnServer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网页上使用了一个DevExpress ASPxButton,需要一种方法来阻止用户双击该按钮。我最初的想法是尝试:

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;
    }

不幸的是,我发现DevExpress停止所有服务器端事件触发时禁用一个按钮。所以我进行了一些谷歌搜索,最后在DevExpress网站(这可能是非常无益的有时),这给了一个官方的工作,他们在他们的网站上的其他帮助线程中提到这个问题。 是供参考的链接。

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
    }

我变成:

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

起初我以为这是工作,但后来意识到它工作了一个双点击,但如果用户第三次点击,它就会继续进行处理。对于什么应该是一个容易的任务,我似乎很难与这个(授予我相对较新的JavaScript,所以也许答案很明显)。如果有人知道如何在第一次点击之后禁用该按钮,同时仍然允许它在服务器上第一次处理,那么将不胜感激。

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 :

这篇关于需要解决方法SetEnabled(false)使用DevExpress按钮停止e.processOnServer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 07:15