This is a migrated thread and some comments may be shown as answers.
Issues On Cancellation
4 Answers 3 Views
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 24 Dec 2019, 07:08 PM

I am trying to redirect to another page on process cancellation (triggered by cancel button).

My progress event is running on separate thread, here is the code:

Public Sub ProgressArea()

        Do
            Dim dt As DataTable = AdminData.getLogPercent(Session("ProjectID"))

            Dim count As Integer = dt.Rows(0)("PercentDone")
            Dim message As String = dt.Rows(0)("RecordDesc")

            context.SecondaryValue = "Total Progress: " & count.ToString() + "%"
            context.SecondaryPercent = count.ToString()
            context.CurrentOperationText = message

            If Response.IsClientConnected = False Then

                Response.Redirect("redirect.aspx")

            End If

            If count < 98 Then
                'calls to itself to repeat
                Thread.Sleep(1000)
            Else
                Exit Do
            End If

        Loop

    End Sub

Code hits the redirect , but nothing happens. However if i redirect without clicking "Cancel" button it does work.

I am completely lost. Any help?

Thank you

4 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 26 Dec 2019, 03:00 PM

Hello David,

The Cancel button is actually cancelling the request, which means the browser does not have any response from the server.

With that said, the only way to redirect on a cancel click is on the client-side.

Regards,
Peter Milchev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
David
Top achievements
Rank 1
answered on 26 Dec 2019, 03:14 PM

I see.

So, what is the client side event i can use?

0
Peter Milchev
Telerik team
answered on 26 Dec 2019, 03:24 PM

Hello David,

I am afraid there is no clean way to subscribe to the cancel button click but you can either subscribe to the click event of the Cancel button or override the internal cancelRequest function:

1) Subscribe to the Cancel button click event

function pageLoadHandler() {
    $telerik.$("#<%= RadProgressArea1.ClientID %>").on("click", ".ruCancel", function () {
        // redirect here... 
        console.log("redirect...")
    })
    // Sys.Application.remove_load(pageLoadHandler);  
}
Sys.Application.add_load(pageLoadHandler);  

 

2) Override internal cancelRequest 

Telerik.Web.UI.RadProgressArea.prototype.cancelRequest = function () {
    this.cancelClicked = true;
    if (this.get_id() == "<%= RadProgressArea1.ClientID %>") {
        // redirect manually here
        console.log("redirect...")
    }
}

Regards,
Peter Milchev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
David
Top achievements
Rank 1
answered on 26 Dec 2019, 03:36 PM

Hi Peter,

I'll look into that

Thank you for your help

David

Asked by
David
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
David
Top achievements
Rank 1
Share this question
or