Strongly typed repeaters in ASP.NET 4.5 (Sitecore 7)

If you use Web Forms then this might be helpful.

In a Repeater (and other data binding container controls) instead of something like this:

<%# ((Sitecore.Data.Items.Item)Container.DataItem)["Field"] %>

You can now do this:

<%# Item["Field"] %>

If you include this Repeater attribute:

ItemType="Sitecore.Data.Items.Item"

We can do this with Sitecore 7 J

For more information http://stackoverflow.com/questions/937244/strong-typed-container-in-webforms

2 thoughts on “Strongly typed repeaters in ASP.NET 4.5 (Sitecore 7)

  1. Cool feature.
    Also, did you know about the SelectMethod attribute of the Repeater in net 4.5?
    It allows you to add a method that gets data for your repeater declaratively, i.e. SelectMethod=”GetCustomers”, where GetCustomers returns an IEnumerable, without needing to do the binding in the code behind with DataSource & DataBind

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.