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

How do I get the dialogue result of the confirm window ?

5 Answers 359 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shain S
Top achievements
Rank 1
Shain S asked on 03 Dec 2009, 03:52 PM
Hi,

How can I use the Confirm dialog in my SL 3 application ? I have used the below code.
But it is showing the dialog and not able to get the dialog result.

Dim dialogParams As New DialogParameters
dialogParams.Content = "Are you sure to delete? Click Yes to delete"
dialogParams.Header = ApplicationName
dialogParams.OkButtonContent = "Yes"
dialogParams.CancelButtonContent = "No"
dialogParams.DefaultPromptResultValue = "No"
RadWindow.Confirm(dialogParams)

How do I get the dialogue result of the confirm window ? ?????



5 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 08 Dec 2009, 11:08 AM
Hello Shain,

Thank you for your interest in our products.

You can get the dialog result of the confirm window by adding an additional event handler to your RadWindow.Confirm method like this:

RadWindow.Confirm(dialogParams.Content, New EventHandler(Of WindowClosedEventArgs)(AddressOf OnClosed))

Private
Sub OnClosed(sender As Object, e As WindowClosedEventArgs)
    
    Dim result As System.Nullable(Of Boolean) = e.DialogResult

End Sub

After that you have the result stored in the result variable.

For more information you can visit http://demos.telerik.com/silverlight/#Window/APC or see the attached sample project.

Best regards,
Konstantina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Hakem
Top achievements
Rank 1
answered on 02 Aug 2016, 05:03 PM
And after doing this, what ist with the Title of the window that is not set? How to handle this?
0
Kalin
Telerik team
answered on 04 Aug 2016, 07:09 AM
Hello Hakem,

You could do the same using only the DialogParameters - please check my answer in the other forum thread:
http://www.telerik.com/forums/set-the-title-when-using-the-radwindow-alert()-method

For more details regarding the DialogParameters - check the following article from our help documentation:
http://docs.telerik.com/devtools/silverlight/controls/radwindow/features/predefined-dialogs

Hope this helps.

Regards,
Kalin
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Stephen
Top achievements
Rank 1
answered on 28 Sep 2016, 09:50 PM

This seems really convoluted way to do a simple thing... You really can't just get the result from a confrim?

I'm looking to essentially replace MessageBox with these functions allowing my own styling and themes to fit with my application.  What I need is to be able to do something like:

 

if(confirm.DialogResult==true)

{ ...do something...}

else

{...do something else...}

If I read this right it looks like I would have to create a separate method to handle the result of the dialog, effectively pushing me out of the method I'm in and adding quite a bit of complexity to the code.  Not to mention that if I need variables from the method I'm calling from I would have to store them globally somehow or...??? I'm not sure.  Those static methods are always modal so why can they not just return the dialog result?

0
Nasko
Telerik team
answered on 30 Sep 2016, 01:36 PM
Hi Stephen,

I am posting my answer here so it could be available for the community.

"In its current implementation of RadWindow using the Closed event is the only approach that you could use to notify when the window gets closed and to take the DialogResults.

However, you could raise the event through a lambda expression and use the variables inside it:
"
string someString = "string";
           RadWindow.Confirm(new DialogParameters() { Content = "Some content", Header = "Confirm" }, (sender, args) =>
           {
               if (args.DialogResult == true)
               {
                   //you could use your variables here
                   someString = "Changed from code";
               }
           });

"This is the only approach that we could suggest you for your scenario."

We hope this will help you.


Regards,
Nasko
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
General Discussions
Asked by
Shain S
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Hakem
Top achievements
Rank 1
Kalin
Telerik team
Stephen
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or