User Control Error: The base class includes the field 'xxx', but its type (yyy) is not compatible with the type of control (zzz).
I'm not a huge user of user controls, but today I was porting an ASP app over to the real world and I figured the particular scenario I was working with didn't really warrant the power of a server control. So after I went an took the 12 seconds out of the day to create a user control all was well. It was working beautifully and all that jazz...until I published the website to the test server!
The base class includes the field 'cltFemaleItems', but its type (Items) is not compatible with the type of control (ASP.items_ascx).
WHAT!!!! I'm marking this one as an ASP.NET 2.0 bug. After a bit of searching online I realized that there aren't really ANY workarounds to this online.
I went back and read the message again and noticed this small hint: "( ASP.items_ascx)". Below is what my user control class declaration looked like and what the declarative directive looks like. Everything looks fine...
<%@ Control Language="C#" AutoEventWireup="true" CodeFile=" Items.ascx.cs" Inherits="Items" %> public partial class Items : System.Web.UI.UserControl
Based on the error message hint, however, changed the name of the contro. Here is what I changed the above code to...
<%@ Control Language="C#" AutoEventWireup="true" CodeFile"Items.ascx.cs " Inherits="items_ascx" %> public partial class items_ascx : System.Web.UI.UserControl
Then I republished and viola! All it well... That's one really weird ASP.NET 2.0 bug. Anyhow, this workaround seems to work well.