Click here to Skip to main content
15,896,201 members
Articles / Web Development / CSS

Support for Generics in ASP.NET Server Controls

Rate me:
Please Sign up or sign in to vote.
4.77/5 (16 votes)
29 Jan 2009CPOL4 min read 61.1K   446   29  
Implementation of a framework to support Generics in ASP.NET server controls, including strong-typing of ITemplate containers.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;

namespace CobaltSoftware.Foundation.Web
{
   /// <summary>
    ///     This sub-class of the generic repeater implements it with concrete types, but
    ///     uses a control builder to cause generic construction.
    /// </summary>
    [ControlBuilder(typeof(GenericTemplatedControlBuilder))]
    [GenericControlType(typeof(GenericRepeater<,>), "CollectionTypeName", "ItemTypeName")]
    public class ObjectRepeater : GenericRepeater<IEnumerable<Object>, Object>
    {
        /// <summary>
        ///     Collection type name.
        /// </summary>
        public String CollectionTypeName { get; set; }

        /// <summary>
        ///     Item type name.
        /// </summary>
        public String ItemTypeName { get; set; }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Insurance Industry
United Kingdom United Kingdom
Steve Gray is a Senior Developer at a British insurance company, working on a popular aggregator. When he's not writing ASP .NET, it's because there's SQL or WCF to write instead.

Comments and Discussions