Repeater嵌套
为上层绑定OnItemDataBound事件
*.aspx部分代码:
<asp:Repeater runat="server" ID="repTest" OnItemDataBound="BindDate">
<ItemTemplate>
<asp:Repeater runat="server" ID="repDate">
<ItemTemplate>
Eval("START_DATE")
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
*.aspx.cs部分代码
protected void BindDate(object obj, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Repeater rep = e.Item.FindControl("repDate") as Repeater;
DataRowView rowView = (DataRowView)e.Item.DataItem;
string strCode = Convert.ToString(rowView["CODE"]);
rep.DataSource = 数据源;
rep.DataBind();
}
}