Confirm message Handler in CodeBehind

  1. #1

    Confirm message Handler in CodeBehind

    I need to open a dialog when I click a button so I here is what I have done:

    Markup:

    <ext:Button runat="server" ID="Button1" Text="Save New Information" OnDirectClick="Button1_DirectClick"/>
    CodeBehind:

    namespace Admin.Modules
        {
            public partial class UsersGrid : System.Web.UI.UserControl
            {
            protected void Button1_DirectClick(object sender, DirectEventArgs e)
            {
                X.Msg.Confirm("Confirm", "Do you want to update this information also?", new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        Handler = "App.Direct.DoYes()",
                        Text = "Yes"
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Handler = "WndwEdit.close()",
                        Text = "No"
                    }
                }).Show();
            }
        
            [DirectMethod]
            public void DoYes()
            {
                X.MessageBox.Info("Error NOT", "Something went lalala", AnchorPoint.LeftTop, UI.Danger).Show();
            }
        }
        }
    The message box is displayed correctly but it doesnt call the DoYes function with error:

    Uncaught TypeError: Cannot read property 'DoYes' of undefined
  2. #2
    Hello @atroul!

    Please use App.direct instead of App.Direct.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello Fabricio,

    I did that change but now I receive this error:
    Uncaught TypeError: App.direct.DoYes is not a function

Similar Threads

  1. [CLOSED] ImageCommandColumn confirm message in mvc
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 18, 2014, 5:48 PM
  2. [CLOSED] confirm message in codebehind?
    By hdsoso in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 27, 2013, 12:00 PM
  3. confirm message box problem
    By mehmood in forum 1.x Help
    Replies: 6
    Last Post: Jun 21, 2012, 1:47 PM
  4. Confirm message handler
    By norphos in forum 1.x Help
    Replies: 1
    Last Post: May 18, 2011, 6:51 AM

Tags for this Thread

Posting Permissions