I have a custom user control that I have built called Rooms.ascx. It contains 2 textboxes, room_name and room_description.
On the page that I want to use the control I have the following code.
<asp:Panel id="pnlRoomCollection" Runat="server">
<MHL:Rooms id="room_1" runat="server"></MHL:Rooms>
<asp:Button id="cmdAddRoom" runat="server" Text="Add Another Room"></asp:Button>
Now when I click cmdAddRoom, I want to add another user control to the panel.
Private Sub cmdAddRoom_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddRoom.Click
Dim o As Control = LoadControl("Rooms.ascx")
This works the first time I click the button, but after I click the button the second time, the user control is created but overrides my previous control. How do I recreate the controls in the panel on postback? I am guess on page_init but I can't seem to find my controls that were on the page before postback in the panel.