views:

214

answers:

1

I'm wanting to have a strongly typed user control that accepts the class PaginatedList<T>

What will my signature for this user control look like and how do I render it?

At the moment I have this as my signature for the user control:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Project.Models.PaginatedList<Project.Models.Product>>" %>

Obviously this doesn't work when I pass a PaginatedList that holds something other than a product. Like here, when I want to send it a PaginatedList of news items:

<% Html.RenderPartial("Pagination", Model.NewsItems); %>

Any help would be much appreciated.

+3  A: 

You could try making your control less strongly-typed and use something like ViewUserControl<IEnumerable>. Or, if you need some of the specific functionality of your PaginatedList, try creating a weakly-typed interface for your PaginatedList class and do ViewUserControl<IPaginatedList>.

Rex M