开发者

List as DataSource for DataList

开发者 https://www.devze.com 2022-12-13 15:53 出处:网络
All Types implement IEnumerable interf开发者_开发技巧ace could be used for a DataSource of a DataList. For example List. But what we will write for the data bound expression in ItemTemplate?

All Types implement IEnumerable interf开发者_开发技巧ace could be used for a DataSource of a DataList. For example List. But what we will write for the data bound expression in ItemTemplate?

List<int> myList = new List<int>();
for(int i=0; i<10; i++)
   myList.Add(i);

myDataList.DataSource = myList;

...
<ItemTemplate>
<asp:TextBox ID="myTextBox" runat="server" Text='<%# Bind(???) %>' />
</ItemTemplate>


Try this:

<%# Container.DataItem.ToString() %>
0

精彩评论

暂无评论...
验证码 换一张
取 消