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);
}
Hi,
thanks for reply.
Controls.Add(window) is usal in the CreateChildControls() Method of a CompositeControl. After replacing the WebDialogWindow with a other container there was no difference.
But I got the result: My mistake was, that I only rendered the WebDialogWindow if the dialog window should be displayed. Now I render the dialog in hidden mode and it works.
Thanks
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.