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

6 posts, 0 answers
  1. Shain S
    Shain S avatar
    2 posts
    Member since:
    Nov 2009

    Posted 03 Dec 2009 Link to this post

    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 ? ?????



  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 08 Dec 2009 Link to this post

    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.
  3. DevCraft banner
  4. Hakem
    Hakem avatar
    2 posts
    Member since:
    Dec 2015

    Posted 02 Aug in reply to Konstantina Link to this post

    And after doing this, what ist with the Title of the window that is not set? How to handle this?
  5. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 04 Aug Link to this post

    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.
  6. Stephen
    Stephen avatar
    2 posts
    Member since:
    May 2012

    Posted 28 Sep in reply to Konstantina Link to this post

    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?

  7. Nasko
    Admin
    Nasko avatar
    587 posts

    Posted 30 Sep Link to this post

    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.
Back to Top
DevCraft banner