T
Tim_Mac
hi,
i'm using a web application project in VS2005. i have a User Control
Template.ascx in the '~/UserControls' folder with the following signature:
public partial class GpTemplate : System.Web.UI.UserControl
I have the user control registered in web.config as follows:
<pages>
<controls>
<add tagPrefix="uc1" src="~/UserControls/Template.ascx"
tagName="GpTemplate"/>
Then in my aspx pages, i use the following code to declare an instance of
the user control
<uc1:GpTemplate ID="Template1" runat="server"></uc1:GpTemplate>
this works fine but as soon as any change is made to the page in VS, i get a
runtime error when next browsing the page, because the partial
ascx.designer.cs file has changed the type of the user control to a generic
System.Web.UI.UserControl. this obviously breaks all the code in the
control that references any of its own controls or properties, e.g.
this.Button1 does not exist in a System.Web.UI.UserControl but it does exist
in the property class GpTemplate.
how can i stop this very annoying behaviour? at the moment i have to do a
text replace for every build on the partial designer classes to fix the user
control type.
thanks in advance.
tim
i'm using a web application project in VS2005. i have a User Control
Template.ascx in the '~/UserControls' folder with the following signature:
public partial class GpTemplate : System.Web.UI.UserControl
I have the user control registered in web.config as follows:
<pages>
<controls>
<add tagPrefix="uc1" src="~/UserControls/Template.ascx"
tagName="GpTemplate"/>
Then in my aspx pages, i use the following code to declare an instance of
the user control
<uc1:GpTemplate ID="Template1" runat="server"></uc1:GpTemplate>
this works fine but as soon as any change is made to the page in VS, i get a
runtime error when next browsing the page, because the partial
ascx.designer.cs file has changed the type of the user control to a generic
System.Web.UI.UserControl. this obviously breaks all the code in the
control that references any of its own controls or properties, e.g.
this.Button1 does not exist in a System.Web.UI.UserControl but it does exist
in the property class GpTemplate.
how can i stop this very annoying behaviour? at the moment i have to do a
text replace for every build on the partial designer classes to fix the user
control type.
thanks in advance.
tim