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

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

1 Answer 54 Views
Telerik Trainer
This is a migrated thread and some comments may be shown as answers.
Chandrashekar
Top achievements
Rank 1
Chandrashekar asked on 12 Feb 2013, 02:06 PM
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 

1 Answer, 1 is accepted

Sort by
0
George
Telerik team
answered on 15 Feb 2013, 04:56 PM
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.

Tags
Telerik Trainer
Asked by
Chandrashekar
Top achievements
Rank 1
Answers by
George
Telerik team
Share this question
or