Want to use generic type in ASP.NET View Page (MVC) RRS feed

  • Question

  • I want to create a generic list view (MVC) that uses reflection for listing attributes.
    For that to work I thought, that I could declare a generic type in the model.

    <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" 
    AutoEventWireup="true" CodeBehind="ReflectiveIndex.aspx.cs" %>
    However it does tell that it does not know the type TController.

    Codebehind is declared as

        public class ReflectiveIndex<TController, TModel> 
    : System.Web.Mvc.ViewPage<IndexView<TController, TModel>>
    where TController: Controller, IPatternController
    where TModel : TableStorageEntity, IComparable<TModel>
    I am not sure, if this is the right forum, but I did not find a better one.

    • Moved by David M Morton Friday, September 25, 2009 3:09 PM ASP.NET (From:.NET Base Class Library)
    Friday, September 25, 2009 3:08 PM


All replies