Using an ASP.NET repeater with an array?

牧云@^-^@ 提交于 2019-12-21 07:52:51

问题


This may be a silly question but I was writing a quick test page and realised that I didn't know how to bind an array or ArrayList of strings, for example, to an ASP.NET Repeater.

I experimented a bit.

    <asp:Repeater ID="rptImages" runat="server">
        <HeaderTemplate>
            <h3>Items</h3>
        </HeaderTemplate>
        <ItemTemplate>
            <p style="background-color:Black;color:White"><%#Eval(Container.DataItem.ToString())%></p>
        </ItemTemplate>
        <FooterTemplate>
            <h4>End of Items</h4>
        </FooterTemplate>
    </asp:Repeater>

Am I being completely stupid? I've only really used it for collections of objects with properties.


回答1:


hoho ...

<%# Container.DataItem %>


来源:https://stackoverflow.com/questions/487318/using-an-asp-net-repeater-with-an-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!