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

Radalert before Response.redirect not working

2 Answers 102 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kavita
Top achievements
Rank 1
Kavita asked on 13 Aug 2013, 09:09 AM
Hello team,

I am having one small issue. I have a save button on my aspx page. I want to redirect to the previous page after a successful save operation, But before redirecting I want to show an alert message saying 'Service Engineer Notified.'
I have used radalert before response.redirect call, but it is not showing the radalert message and directly redirecting to the previous page.
I don't want to modify the radalert template.
What can be done?

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 13 Aug 2013, 09:57 AM
Hi Kavita,

Please note that RadWindow's radalert, radprompt, radconfirm functions cannot block the execution thread and can exist only in the page from which they were created - that is why you don't see the alert dialog before redirecting to another URL. One suggestion is you can display the RadAlert from server side code and you can redirect to another URL using the client side code so that redirection happens only after displaying the RadAlert. Please have a look at the following code I tried which works fine at my end.

ASPX:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
</telerik:RadWindowManager>
<telerik:RadButton ID="RadButton1" runat="server" Text="Save" OnClick="RadButton1_Click1">
</telerik:RadButton>

C#:
protected void RadButton1_Click1(object sender, EventArgs e)
{
    //Your Code
    RadWindowManager1.RadAlert("Service Engineer Notified", 250, 150, "Notification", "callBackFunction");
}

JavaScript:
<script type="text/javascript">
    function callBackFunction(arg) {
        window.location.href = "http://www.yourlink.com";
    }
</script>

Thanks,
Princy.
0
Kavita
Top achievements
Rank 1
answered on 13 Aug 2013, 10:25 AM
Ok princy..
Thanks for your reply.
Tags
General Discussions
Asked by
Kavita
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Kavita
Top achievements
Rank 1
Share this question
or