I am building an application that used the placement of panel controls at runtime. Inside of these panels I would like to add multiple buttons. This is part of a scheduling application that I will not be
reusing (if I can help it). I get an error on the addition of the button controls.... "Must be placed inside a container with runat="server" attribute";
I can not set the runat="server" for a control that is created at runtime (Panel).
Any suggestions?
Sample Code:
Panel objPanel = new Panel();
objPanel.HorizontalAlign = HorizontalAlign.Center;
Button objButton = new Button();
objButton.Text = "Test";
....eventHandler stuff etc.
objPanel.Controls.Add(objButton);
PlaceHolder1.Controls.Add(objPanel);