TL;DR: All controls within a usercontrol that's being used outside it's home project are null when that usercontrol's Page_Init/Page_Load methods are called.
The setup is like this:
Projects "UI.Frontend", "UI.ControlPanel", and "UI.Common" are "ASP.NET Web Application"s. UI.Common is never meant to be accessed directly- it just contains UserControls that are needed in both the frontend and the control panel.
So, an aspx file (SomeFrontendPage.aspx) in UI.Frontend contains the lines:
<%@ Register tagprefix="BP" Namespace="UI.Common" Assembly="UI.Common" %>
and later:
<BP:MyControl runat="server" ID="ctlMyControl" />
while over in UI.Common, there's a control named MyControl (normal ascx, ascx.cs, and ascx.designer.cs files). Now, when I open SomeFrontendPage.aspx in a browser, ctlMyControl gets loaded and it's init+load methods get executed. The problem is all subcontrols of MyControl never get initialized. Example (if MyControl.ascx has a textfield of ID txtBlah):
protected void Page_Init(object sender, EventArgs e)
{
txtBlah.Text = "test";
}
The above code will run, but will cause a null pointer (well, "Object reference not set to an instance of an object") since txtBlah will be null.
Edit: An example control would be:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MyControl.ascx.cs" Inherits="Common.MyControl" %>
Whatever: <asp:TextBox ID="txtWhatever" runat="server" />