This is a migrated thread and some comments may be shown as answers.

SingleClick RadButton - Re-Enabling after radProgressArea Cancel Click

2 Answers 233 Views
Button
This is a migrated thread and some comments may be shown as answers.
Top Coder
Top achievements
Rank 1
Top Coder asked on 23 Oct 2015, 05:53 PM

I have a form with a rad button, with single click enabled. 

On that form I have a RadProgressArea with the cancel button. 

When the cancel button is pressed on the RadProgressArea - The RadButton doesn't re-enable.

How do I get it to re-enable, I tried the code below, but the button remains in it's disabled state. 

If Not Response.IsClientConnected Then
    'Cancel button was clicked or the browser was closed, so stop processing
    radbutton.enabled = true
    exit sub
end if

                         

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 27 Oct 2015, 01:58 PM

Hi,

The Single Click feature of RadButton waits for the postback to return in order to re-enable the button. RadProgressArea uses a separate handler for its update and RadButton cannot monitor that as well.

Nevertheless, you can re-enable the button via its client-side API (http://docs.telerik.com/devtools/aspnet-ajax/controls/button/client-side-programming/overview):

<telerik:RadButton ID="RadButton1" runat="server" Text="Submit" SingleClick="true" SingleClickText="Please wait..." OnClick="RadButton1_Click">
</telerik:RadButton>
<asp:Button ID="Button1" Text="click me within 5 seconds of the postback" OnClientClick="reEnable(); return false;" runat="server" />
<script>
    function reEnable() {
        var btn = $find("<%=RadButton1.ClientID%>");
        btn.enableAfterSingleClick();
    }
</script>
protected void RadButton1_Click(object sender, EventArgs e)
{
    System.Threading.Thread.Sleep(5000);
}

To get the click on the progress area Cancel button, you can attach a handler to it:

<script>
    function reEnable() {
        var btn = $find("<%=RadButton1.ClientID%>");
        btn.enableAfterSingleClick();
    }
    function attachHandlersToCancelButton() {
        $telerik.$(".ruCancel", $find("<%=RadProgressArea1.ClientID%>").get_element()).on("mousedown", reEnable);
    }
</script>
<telerik:RadButton ID="RadButton1" runat="server" Text="Submit" SingleClick="true" SingleClickText="Please wait..." OnClick="RadButton1_Click" OnClientClicking="attachHandlersToCancelButton">
</telerik:RadButton>

where you may want to remove the handler when it is called to avoid attaching it multiple times and the server code can be taken directly from the Custom progress article: http://docs.telerik.com/devtools/aspnet-ajax/controls/progressarea/custom-progress.

Regards,

Marin Bratanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Top Coder
Top achievements
Rank 1
answered on 05 Nov 2015, 02:55 AM

Thanks a lot, Marin. 

Your solution worked!

Tags
Button
Asked by
Top Coder
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Top Coder
Top achievements
Rank 1
Share this question
or