3

Possible Duplicate:
Why does ASP.NET auto-generated .designer code have the incorrect type?

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!!

Community
  • 1
  • 1
Mike Cole
  • 14,474
  • 28
  • 114
  • 194

3 Answers3

1

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

Community
  • 1
  • 1
Anders Fjeldstad
  • 10,724
  • 2
  • 33
  • 50
0

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

IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
  • Yes, that's the point. It doesn't seem to be generating correctly. – Mike Cole Dec 11 '09 at 02:27
  • Mike, Check this article: http://www.west-wind.com/WebLog/posts/707067.aspx Sometimes 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 Dec 11 '09 at 03:52
  • this did not fix the problem. It seems inconsistent. An explanation would be most appreciated. – Mike Cole Jan 07 '10 at 20:49
0

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.

Maxime Rouiller
  • 13,614
  • 9
  • 57
  • 107