前台代码部分:
后台代码部分:
private void function2(object sender,repeateritemeventargs e)
{
//判断里层repeater处于外层repeater的哪个位置(alternatingitemtemplate,footertemplate,headertemplate,itemtemplate,separatortemplate)
if(e.item.itemtype == listitemtype.item || e.item.itemtype == listitemtype.alternatingitem)
{
repeater rpt = e.item.findcotrol("repeater2") as repeater; //找到里层的repeater对象
datarowview row = (datarowview)e.item.dataitem; //找到分类repeater关联的数据项
int typeid = convert.toint32(row["id"]); //获取填充子类的id
rpt.datasource = datatable;
rpt.databind();
}
}