Radalert before Response.redirect not working

3 posts, 0 answers
  1. Kavita
    Kavita avatar
    39 posts
    Member since:
    Feb 2013

    Posted 13 Aug 2013 Link to this post

    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 Aug 2013 Link to this post

    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.
  3. Kavita
    Kavita avatar
    39 posts
    Member since:
    Feb 2013

    Posted 13 Aug 2013 Link to this post

    Ok princy..
    Thanks for your reply.
Back to Top