I have a user control containing asp: Literal.
<div>
<asp:Literal id="MenuContainer" runat="server" />
</div>
There is code on the page with the code that initializes the control:
internal void Setup(MyBusinessObject obj)
{
MenuObject menu = MenuHelper.GetMenu(obj.State);
if(obj == null)
MenuContainer.Visible = false;
}
On the page where the control is used, I call the Control Settings method in the LoadComplete event handler (I first called it in the Load event). Regardless of whether MyBusinessObject is null or not, when I access Literal under user control, I get an error:
Object reference not set to an instance of an object.
What is the reason and why is this tool?
source
share