Base class includes field but type not compatible with type of control

好久不见. 提交于 2019-12-04 23:46:25

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

robert jebakumar2

Refer the ascx user control in the web.conf instead of the aspx page like this:

<add tagPrefix="proj1" src="~/userControls/Invoiceshow.ascx" tagName="proj1tagname">

That solved my issue.

Encountered this problem while converting a Web Forms website to MVC Web App, and changing target framework to 4.6. The solution for me was to set the controlRenderingCompatibilityVersion attribute on the pages element in web.config:

<system.web>
   <pages validateRequest="true" controlRenderingCompatibilityVersion="4.6" clientIDMode="AutoID">
</system.web>

I know this is old, but I had the same error trying to change a textbox to a label control. I simply changed the ID of the control from "Insulin" to "Insulin2" which fixed the issue. I'm not sure why it worked, but that may be a question for Microsoft.

After looking into this more, I noticed if I closed the tab of the page I was working on in Visual Studio and then reopened it, the error went away all together? I hope this helps somebody.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!