vb.net controls:
I've created a web control that contains my navigation area. By
default, I set the visibility of some groups of buttons to be false.
When a page calls the navigation control, I want to programmatically
change the visibility for the set of buttons associated with the
calling page from invisible to visible. For example, when the "Add
Data" page calls the navigation, the various Add buttons will be
visible. When the "Search" page calls the navigation, the Add buttons
will not be visible.
I'm adding the navigation to the target pages by reference (which seems
to be working fine). Inside the navigation control (Navigation.ascx), I
have a Web Forms Panel named "AddNewIncidentPanel" that contains the
buttons I want to see (or hide). The aspx page that calls
Navigation.ascx uses a placeholder to handle the insertion of the
navigation area.
In my code-behind page, I've got:
---
Dim NavigationControl As Control = LoadControl("Navigation.ascx")
NavigationHolder.Controls.Add(NavigationControl)
AddNewIncidentPanel.Visible = True
---
When I run this code, I get the following error:
---
System.NullReferenceException: Object reference not set to an instance
of an object.
---
I've tried a number of Intellisense-suggested options and I'm sure I'm
overlooking something really obvious, but I'm stuck.
Where have I gone wrong?
Thanks!
Scott