I have created a simple ASP.net Web Application (2.0) and have added a web user control.
Now in my page I have added this control but I have registered like this,
<%@ Register Assembly="WebApplication1" Namespace="WebApplication1" TagPrefix="Custom" %>
Which means I want to access all the controls in my current Web Application project
Then I have added my user control like this,
<Custom:MyUserControl ID="MyUserControl1" runat="server" PublicProperty="Hello" />
Every thing is fine but when I execute the project, NO control on my user control gets "instantiated" and thus I receive error "Object Reference Not Set"
Note that My Control has,
1) Public property PublicProperty as String
2) 1 Label control
In Load Event Handler I am setting Text property of Label Control to PublicProperty. Here object reference NOT set error occurs (which means Label control is NOT initialized).
I don't want to register my control using Src, TagPrefix etc. Any ideas?
View Complete Post