Have you received this error?
The base class includes the field ‘MyUserControl_1, but its type (MyUserControl) is not compatible with the type of control (ASP.MyControl_ascx).
Or in my case:
The base class includes the field 'proxyContainer', but its type (ProxyContainer) is not compatible with the type of control (ASP.maintenance_proxycontainer_ascx).
Well first you should check out this article and see if it fixes your problem:
However for some of you (myself included) that article didn’t do squat to fix my problem with the error listed above, I don’t want to keep my control in the same folder as my pages.
Based on the article above I fall under the category of: “The application contains references to Web pages that are outside the current directory.”
My code uses a "ProxyContainer.ascx" UserControl that references another user control on another server in another assembly. I register the control on a page and one of my properties is to point to the HostServerURL and ControllerInstanceId.
Everytime I changed anything at all the code threw me the above said error. (Even when it was just a char on the HTML page).
In the ASPX Page I was referencing my ProxyContainer.ascx everytime I made any changes at all the auto generated designer code was changing my type from
protected global::System.Web.UI.UserControl proxyContainerControl;
protected global::ProxyContainer proxyContainerControl;
Which then caused my circular reference.
I need to stop the auto-generated code from changing my type and I’m set. I moved the code:
“protected global::ProxyContainer proxyContainerControl;”
Into the code behind at the class level fields and the designer stopped generating my type and now it all works.
I was helping somebody on Expert Exchange and their problem was to Change their Codebehind to a CodeFile in the ASCX file.