The base class includes the field 'lbl', but its type (web.App_Code.CustomLabelControl) is not compatible with the type of control (web.App_Code.CustomLabelControl).
I had done many custom controls before the same way but today I ran into this error.
I have a web application project with the below class in App_Code
directory a tagprefix reference in web.config for the control in class.
What do I do now?
<system.web>
<pages>
<controls>
<add namespace="web.App_Code" tagPrefix="CControls"/>...
<form id="form1" runat="server">
<div>
<CControls:CustomLabelControl runat="server" OnClickText="Welcome" ID="lbl">
</CControls:CustomLabelControl>
</div>
</form>
namespace web.App_Code
{
public class CustomLabelControl : Control, IPostBackEventHandler, IPostBackDataHandler
{
private string _onClickText;
public CustomLabelControl()
{
}
public string OnClickText
{
get { return _onClickText; }
set { _onClickText = value; }
}
public void RaisePostBackEvent(string eventArgument)
{
throw new System.NotImplementedException();
}
public bool LoadPostData(string postDataKey, NameValueCollection postCollection)
{
throw new System.NotImplementedException();
}
public void RaisePostDataChangedEvent()
{
throw new System.NotImplementedException();
}
}
}
The base class includes the field 'btnLogin', but its type (FoodOrder.App_Code.LinkButtonDefault) is not compatible
http://support.microsoft.com/kb/919284
Base class includes the field 'X', but its type (System.Web.UI.ScriptManager) is not compatible with the type of control (System.Web.UI.ScriptManager)
Try specifying the assembly name too:
<add tagPrefix="CControls" namespace="web.App_Code" assembly="web.App_Code" />
I would consider creating a dedicated namespace for your custom controls, just for the sake of clarity. Maybe something like web.App_Code.CustomControls
:
<add tagPrefix="CControls" namespace="web.App_Code.CustomControls" assembly="web.App_Code.CustomControls" />
Unckeck the build (and publish) option "Allow this precompiled site to be updatable"
It might not be enought for the runtime, so check the option "use fixed naming and single page assemblies" and it solved my case :)
here is a useful link about this error: http://forums.asp.net/t/960707.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With