Messagebox Yes/No before changing switch the Toggle

2 posts, 0 answers
  1. Mehdi
    Mehdi avatar
    6 posts
    Member since:
    Sep 2017

    Posted 07 Jul 2019 Link to this post

    hi all

    i want to send a question to user "are u sure to switch off?" when user click on slide the toggle switcher.

    how can do this?

    set the snipped code in valueChanging action, but if user click on "No", the toggle switch to off!

     

    if (switchtg.Value)
                    {
                        RadMessageBox.Instance.StartPosition = FormStartPosition.CenterParent;
                        if (RadMessageBox.Show("Are u sure ?", "disconnecting...", MessageBoxButtons.YesNo,
                                RadMessageIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            //_allowdc = true;
                            switchtg.Value = true;
                            //switchtg.ValueChanged -= switchtg_ValueChanged;
                        }
                        else
                        {
                           // _allowdc = false;
                            switchtg.Value = false;
                            //switchtg.ValueChanged -= switchtg_ValueChanged;
     
                        }
     
                    }
  2. Mehdi
    Mehdi avatar
    6 posts
    Member since:
    Sep 2017

    Posted 07 Jul 2019 in reply to Mehdi Link to this post

    i'm so sorry, found the solution.

    use=> e.cancle = true 

    problem fixed.

     

Back to Top