protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetDate("1,2,3,4,5,6,7", ',');
}
}
void GetDate(string str, char split)
{
List<string> lst = new List<string>();
foreach (string val in str.Split(split))
{
lst.Add(val);
}
rpt1.DataSource = lst;
rpt1.DataBind();
}
前台如何绑定啊?
<asp:Repeater ID="rpt1" runat="server">
<ItemTemplate>
</ItemTemplate>
</asp:Repeater>
<asp:Repeater ID="rpt1" runat="server">
<ItemTemplate>
<%# ((string)Container.DataItem)%>
</ItemTemplate>
</asp:Repeater>
谢谢。刚才也遇到这个问题了