I am trying to put as much code in code-behind as possible, thus reducing the size of my .aspx file. I relation to this I have put the Page_Load method in a .cs file and inherited Page.
However this causes some problems. Before moving the Page_load method I was able to do something like this...
main_ascx obj001 = (main_ascx) Page.LoadControl("controls/main.ascx");
and using this directive to register the user control...
<%@ Register TagPrefix="OCMS" TagName="View" src="controls/main.ascx" %>
I do not know how to do the registration of the user control in code-behind. I have tried to use the first piece of code in the code-behind, and leaving the regisrtation in the .aspx file, however this does not work. I get this...
OCMScore.cs(14,5): error CS0246: The type or namespace name 'main_ascx' could not be found (are you missing a using directive or an assembly reference?)
How can I make a using directive or an assembly reference in code-behind when I have got no namespace!? Or do I have a namespace?