views:

188

answers:

3

Hi, On my .aspx page, I have the following declaration to user my user control:

<%@ Register TagPrefix="uc" TagName="ProductCategoryMenu" Src="~/Resources/Common/Controls/productCategoryMenu.ascx" %>

<uc:ProductCategoryMenu ID="ProductCategoryMenu" runat="server" />

Whenever the .designer file autogenerates, it declares

protected global::System.Web.UI.UserControl ProductCategoryMenu;

instead of the actual type of my user control. Is there a way I can change that so I don't always have to open the .designer.cs file and correct it? Thanks!!

A: 

You're not supposed to manually edit the Designer file.

IrishChieftain
Yes, that's the point. It doesn't seem to be generating correctly.
Mike C.
Mike,Check this article:http://www.west-wind.com/WebLog/posts/707067.aspxSometimes it can be cause by a name conflict with another file. Usually when I get really desperate, I zap the temp files (you may have to stop IIS to do this). Zap and re-create the UC. Also, check the compile properties in VS. Are you using a WAP? Reason I ask is because there are known problems when using UCs with the website project model:http://west-wind.com/weblog/posts/3016.aspx
IrishChieftain
I am using a WAP.
Mike C.
this did not fix the problem. It seems inconsistent. An explanation would be most appreciated.
Mike C.
A: 

The easiest solution for you might be to remove the variable declaration from the MyPage.designer.cs into the MyPage.cs. It should normally not re-declare the variable into the MyPage.designer.cs.

Tell me if that fix your issue.

Maxim
Yeah, I assume that will fix the issue, but it's just weird that it's so inconsistent.
Mike C.
A: 

Check this discussion out - I think it will solve your issue. It's about helping the application resolve the ~ correctly.

Anders Fjeldstad
Yup, that sounds right. Thanks!
Mike C.