ASPNET WebForms Server Control is NULL in Page_Load ASPNET WebForms Server Control is NULL in Page_Load asp.net asp.net

ASPNET WebForms Server Control is NULL in Page_Load


I answered my own question above.

Solution: I just found the answer myself. Using this declaration for the usercontrol on the page fixed the problem:

<%@ Register TagPrefix="cw" TagName="ArticleColumn" Src="~/Templates/Units/ArticleColumn.ascx" %>

This faulty declaration was added using ReSharper right click menu from html view:

<%@ Register TagPrefix="cw" Namespace="MyNamespace.Templates.Units" Assembly="MyNamespace" %>

Thanks for the help! :)


DataBind is something for binding the controls written in aspx part with server side script ie <% %>.

But your scenario does not require to call databind(). Just assigning the values to controls should work fine.

Try by removing databind from your code.


Update the content of the user control from the page.

Declare properties in the user control to update the labels content and use those properties from the page with the user control instance.