Asp – User Controls Not seeing the Day of Light – Doesn’t recognize code-behind methods

asp.netvisual-studio-2008

This is driving me absolutely nuts.

I created a new WAP project in VS 2008. Copied over the files in my Web Site Project. Added any required references. Tried to convert the Web Project to a Web Application using the "Convert to web application".

None of my user controls are able to see methods in their code behind. They don't even see them so I get errors everywhere saying it doesn't know what this or that method is.

Example:

<%=CreateMenu(xxx.WebMenuType.Occasion, "menuShopOccasion", "Occasion") %>;

That is in my Header.ascx

And so it errors out because it has no clue what CreateMenu is!

In my Header.ascx.cs it's there and was being referenced with no problem in my old Web Site Project:

protected string CreateMenu(xxx.WebMenuType menuType, string menuID, string title)
    {

...

}

Best Answer

I am not entirely sure this is your problem but....

you may be missing the .designer.cs files. For your example above there would also be a Header.ascx.designer.cs which contains a partial class (Header) which has all the declarations of the controls in the Header.ascx file?