Click here to Skip to main content
15,897,371 members
Articles / Web Development / ASP.NET

A Typed Repeater in ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.89/5 (43 votes)
17 Mar 20074 min read 133.7K   1.2K   87  
Hacking ASP.NET to build a Repeater with generics support
using System;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace AshMind.Web.UI.Research
{
    [ControlBuilder(typeof(RepeaterControlBuilder))]
    public class Repeater : System.Web.UI.WebControls.Repeater
    {
        private string dataItemTypeName;

        public string DataItemTypeName
        {
            get { return dataItemTypeName; }
            set { dataItemTypeName = value; }
        }
    }

    public class Repeater<TDataItem> : Repeater
    {
        protected override RepeaterItem CreateItem(int itemIndex, ListItemType itemType)
        {
            return new RepeaterItem<TDataItem>(itemIndex, itemType);
        }
    }
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions