ASP.NET - Web Application, UserControls and NullReferenceExceptions

Posted by Echilon on Stack Overflow See other posts from Stack Overflow or by Echilon
Published on 2010-04-27T11:28:51Z Indexed on 2010/04/27 11:33 UTC
Read the original article Hit count: 370

I have a web application, which works fine if I include my user controls with

<%@ Register TagPrefix="mine" TagName="MyUC1" Src="~/UserControls/MyUc1.ascx" %>
<%@ Register TagPrefix="mine" TagName="MyUC2" Src="~/UserControls/MyUc2.ascx" %>

But I need to use the namespace due to needing to integrate with Umbraco. When I replace the register declaration with:

<%@ Register TagPrefix="mine" Namespace="MyAssembly.UserControls" Assembly="MyAssembly"%>

I get a null reference exception in the UserControl's Page_Load event (which references an ASP.NET control which is used by the UserControl itself.

I find this pretty bizarre, but I've found very little information on how to fix it.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about web-applications