XPathSelect

From Luca Mauri Wiki
Jump to navigation Jump to search

XPathSelect per impostare una DataSurce in un controllo nidificato

Esempio

<div id="projectscontainer" style="display: flex; flex-direction: row; flex-wrap: wrap; justify-content: space-around; align-items: flex-start;">
        <asp:XmlDataSource ID="XmlDSProjects" runat="server" DataFile="/App_Data/projects.xml"></asp:XmlDataSource>
        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="XmlDSProjects">
            <HeaderTemplate>
            </HeaderTemplate>
            <ItemTemplate>
                <div style="padding: 0px; width: 50%">
                    <div style="padding: 8px;">
                        <h2><%#XPath("label")%></h2>
                        <div style='width: 100%; height: 4px; background-color: <%#XPath("color")%>'></div>
                        <p style="padding: 0px;">
                            <img src="<%#XPath("icon")%>" style="float: left; margin: 5px" width="96" />
                            <%#XPath("text")%>
                        </p>
                        <asp:Repeater ID="RPTProjLinks" runat="server" DataSource='<%# XPathSelect("links") %>'>
                            <HeaderTemplate>
                                <p>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <a href="<%#XPath("link")%>"><%#XPath("link/@label")%></a>
                            </ItemTemplate>
                            <SeparatorTemplate> | </SeparatorTemplate>
                            <FooterTemplate>
                                </p>
                            </FooterTemplate>
                        </asp:Repeater>
                    </div>
                </div>
            </ItemTemplate>
            <FooterTemplate>
            </FooterTemplate>
        </asp:Repeater>
    </div>

External Link