Access parent data in a nested strongly typed repeater

Lets say I have a class structure that looks something like this:

public class A
    public string Poperty1 { get; set; }
    public string Poperty2 { get; set; }
    public List<B> Property3 { get; set; }

public class B
    public string Property4 { get; set; }
    public string Property5 { get; set; }

...and a couple of nested repeaters that look like this:

<asp:Repeater ItemType="A" runat="server">
        <asp:Label Text="<%# Item.Property1 %>" runat="server" />
        <asp:Repeater runat="server" DataSource="<%# Item.Property3 %>" ItemType="B">
                <asp:Label Text="<%# Item.Property4 %>" runat="server" />

How would I access Property2 from the second repeater?


Well, from Accessing parent data in nested repeater, in the HeaderTemplate, I found the following solution. It's not the prettiest, but it works:

<%# ((Container.Parent.Parent as RepeaterItem).DataItem as A).Property2 %>

Need Your Help

Contact form validation issue

php javascript forms validation

I've made a PHP contact form for a client and they've come back to me saying they are receiving blank emails like this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.