protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//查询出父级的名称放到dataTable
// 绑定到repeate里去
repeater1.DataSource ="";
repeater1.DataBind();
}
//这个是嵌套的第二个repeater
protected void rt_Title_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DataRowView row = e.Item.DataItem as DataRowView;
if (null != row)
{
string ForID = row["应用的父级ID"].ToString();
Repeater rp_Title = e.Item.FindControl("名称") as Repeater;
if (null !=rp_Title)
{
//得到的dataTable绑定
rp_Title.DataSource = “”;
rp_Title.DataBind();
}
}
}
}
这样就可以实现你的想要的功能了。