How to raise alert on before unloading the radwindow and perform functions according to the option selected

2 posts, 0 answers
  1. Chandrashekar
    Chandrashekar avatar
    2 posts
    Member since:
    Sep 2012

    Posted 12 Feb 2013 Link to this post

    Sir/Madam

    My requirement is:

    i want to show an alert "You will loose changes you made if you continue. Please press Ok to continue and press cancel to stay on the same page".
    and two options "ok" and cancel to be shown on the dialog.

    how can i achieve this. This works with onbeforeunload event for normal modal windows but doesn't work with radwindow.

    Are there any settings for it 
  2. George
    Admin
    George avatar
    1332 posts

    Posted 15 Feb 2013 Link to this post

    Hello,

    I would suggest using RadAlert predefined window for this scenario. You could open the alert window and in the closed event handler you could execute the custom logic that depends on the DialogResults:

    RadWindow.Alert("You will loose changes you made if you continue. Please press Ok to continue and press cancel to stay on the same page", this.OnClosed);
     
    private void OnClosed(object sender, WindowClosedEventArgs e)
    {
        if (e.DialogResult.HasValue && e.DialogResult.Value)
        {
            // Ok is pressed
        }
        else
        {
            // The alert window is canceled or closed.
        }
    }

    You could refer to our online documentation for additional information here - http://www.telerik.com/help/wpf/radwindow-features-predefined-dialogs.html

    Hope this helps.

    All the best,
    George
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top