Forum Moderators: open
Protected Sub searchButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myControl As New Control
myControl = Page.FindControl("bodyContent")
'find my control
Dim searchControl As UserControl = CType(LoadControl("Search.ascx"), UserControl)
myControl.Controls.Add(searchControl)
End Sub
To give you the layout. The master page registers the ascx page and puts it in a content pane on the left. Then, the default page is a child of the master page and loads the initial content into the main frame on the right. The left conent has three panes. If you open the search pane and click on the search button. It gives you a null reference error because I am not getting the panel correctly. Since the search button is in the ascx page that is loaded by the master page, I'm not for sure how to do this. Here is where the panel is in my default page. Thanks,
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<asp:Panel ID="bodyContent" runat="server">
</asp:Panel>
</asp:Content>