I'm trying to build some .ascx controls into a class library for plugins for a CMS I'm building.
My project type is a typical C# class libary with references added for system.web.mvc & friends.
My problem arises in trying to create a strongly-typed user control. My control looks like this:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TagCloudWidget.Models.TagCloudWidgetData>" %>
Even though I have another public class in the same project under the namespace TagCloudWidget.Models
, I can't seem to get the .ascx
file to recognize this. I've tried including Imports
for the namespace, but then it just complains that the namespace doesn't exist. The TagCloudData class file looks like this:
namespace TagCloudWidget.Models
{
public class TagCloudWidgetData
{
public IList<TagCount> TagCounts { get; set; }
public ContentTypes ContentType;
public string Controller;
public string Action;
public TagCloudWidgetData(IList<TagCount> tagCounts, ContentTypes contentType, string controller, string action)
{
TagCounts = tagCounts;
ContentType = contentType;
Controller = controller;
Action = action;
}
}
}
Can you see what I'm doing wrong?
Since the suggestion below, I've tried adding a code-behind file. I think I'm closer to figuring out what's wrong, but I'm still not able to find a solution. In the project, I've added references to System.Web and System.Web.Mvc. But, in the using section of the codebehind file, when I type "using System.", auto-complete doesn't even show System.Web or System.Web.Mvc as available options. It's like they just don't exist on disc. Other projects are able to include them and reference them just fine. I suppose this is the source of my problem, so I'm hopeful once I figure this out the rest will just fall into place. Ideas?