Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
290
Button events do not fire
posted

Hallo,

I created a composite control with a WebDialogWindow in it. In the dialog window there are two buttons. On both buttons are click event and Command event registered. If I click one of the two buttons the dialogs closes but non of the two events are fired.

How to get this events fired?

Ich have a similar szenario but not in a composite control and there everethings works fine.

 

                WebDialogWindow window = new WebDialogWindow();

                window.ID = "dlgMessageBox";

                window.Modal = true;

                window.Header.CloseBox.Visible = false;

                window.InitialLocation = DialogWindowPosition.Centered;

                window.Style[HtmlTextWriterStyle.Width] = "100%";               

                window.ContentPane.Style[HtmlTextWriterStyle.TextAlign] = "center";

                Controls.Add(window);

 

 

        private void AddButton(ControlCollection collection, DialogResult result, string text)

        {

            Button button = new Button();

            button.Text = text;

            button.ID = "btn" + result.ToString();

            button.CommandArgument = result.ToString();

            button.Command += new CommandEventHandler(button_Command);

            button.Click += new EventHandler(button_Click);

            button.CausesValidation = true;

            collection.Add(button);

        }

 

Parents
No Data
Reply
  • 24497
    posted

    Hi,

    I can suggest you to debug by temporary replacement of WebDialogWindow by any container, let say, by asp:Panel. Maybe you will get same result.
    If your codes "Controls.Add(window)" are located in Page, then that is probably the reason. You should use something like "this.Form.Controls.Add(window)" instead.

Children