ASP.Net error - type is not compatible with the type of control

蓝咒 提交于 2019-11-29 10:37:01

OK,

So after trying a lot of stuff that didnt work i found a solution, i dont like this solution but it works,

I went to the page.designer.vb file, and then looked for the 'html' and 'Head1' properties that were generated there,

In there i replaced their types to System.Web.UI.HtmlControls.HtmlGenericControl

Afterwards, it worked.

Weird bug, nothing else (including the "hot fixes" that are mentioned in other posts helped.

Hope this would help some one out there .

Somehow the designer file and the markup file get out of sync, even if the types appear to match.

I changed the ID attribute of the problematic control, saved, and rebuilt in the markup file. I then changed it back to the original ID, saved, and rebuilt.

Problem goes away!

Weird issue it is I am not sure if there is a proper solution for this but what worked for me was simply changing the Control ID. and then designer.cs file was changed and all worked good.

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