<asp:DataList ID="rptItem" runat="server" RepeatColumns="3" Width="100%" />
使用DataList直接搞定,为什么要用Repeater
这个好解决,用这种方式吧。
ArrayList values = new ArrayList();
values.Add(new ListItem("text1", "text2"));
values.Add(new ListItem("text3", "text4"));
values.Add(new ListItem("text5", "text6"));
Repeater1.DataSource = values;
Repeater1.DataBind();
Code
public class ListItem {
private string key;
private string value;
public ListItem (string key, string value) {
this.key = key;
this.value = value;
}
public string Key{
get {
return key;
}
}
public string Value{
get {
return value;
}
}
}
噢,来晚了。二楼正解
嗯,来晚了