views:

122

answers:

2

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)
    {

...

}
+1  A: 

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?

Simon Fox
I can't create the designer file for my master page, it errors out on user and custom control references
CoffeeAddict
yes, the header control has a designer file that is good.
CoffeeAddict
the .designer file errors out? have you included the correct using statements for those custom controls?
Simon Fox
+1  A: 

It's probably a namespace problem. Make sure that the Inherits attribute in your <%@ Page ... %> declaration refers to the correct path to the code behind file, including the namespace. The designer file must also be in the same namespace as the code behind.

Jamie Ide