Nested repeater gives "wrong server tag"?

I am trying to make a nested repeater as described here , but this is a mistake.

My repeater is as follows:

<asp:Repeater ID="HouseholdRepeater" runat="server">
    <ItemTemplate>
        <div><b><%# DataBinder.Eval(Container.DataItem,"Name") %></b></div>
        <div>
        <asp:Repeater ID="ApplicationRepeater" runat="server" DataSource="<%#((DataRowView)Container.DataItem).Row.GetChildrows("Applications") %>"> <!-- error here -->
            <ItemTemplate>
            <div>
                <a href="<%# DataBinder.Eval(Container.DataItem,"Link") %>"><%# DataBinder.Eval(Container.DataItem,"Description") %></a>
            </div>
            </ItemTemplate>
        </asp:Repeater>
        </div>
    </ItemTemplate>
</asp:Repeater>

The error message I get is "Server tag is badly formed."

This looks like an example to me. I do not see what is wrong with this. Any ideas how to make this work?

In addition, I bind it in code using the anonymous object from the Linq query.

+3
source share
4 answers

You use double quotes to indicate your DataSource property, but your DataSource contains double quotes. Try to include the DataSource in single quotes:

DataSource='<%#((DataRowView)Container.DataItem).Row.GetChildrows("Applications") %>'
+5
source

Change

Row.GetChildrows("Applications")

to

Row.GetChildrows(""Applications"")


Also change

<a href="<%# DataBinder.Eval(Container.DataItem,"Link")

to

<a href="<%# DataBinder.Eval(Container.DataItem,""Link"")

+1

DataSource ... DataSource -

'<% # DataBinder.Eval (Container, "DataItem.ChildTable")%>'

0
source

Edit

DataSource="<%#((DataRowView)Container.DataItem).Row.GetChildrows("Applications") %>"

to

DataSource='<%#((DataRowView)Container.DataItem).Row.GetChildrows("Applications") %>'
0
source

All Articles