Repeater嵌套数据绑定

简介:这是Repeater嵌套问题 - .NET技术 / ASP.NET的详细页面,介绍了和asp.net,Repeater嵌套问题 - .NET技术 / ASP.NET有关的知识,加入收藏请按键盘ctrl+D,谢谢大家的观看!

 

1 private void RpTypeBind()
2 {//GetQuestionTypeAndCount() 返回一个datatable
3   this.rptypelist.DataSource = LiftQuestionCtr.GetQuestionTypeAndCount();
4 this.rptypelist.DataBind();
5 }
6 protected void rptypelist_ItemDataBound(object sender, RepeaterItemEventArgs e)
7 {
8  //判断里层repeater处于外层repeater的哪个位置( AlternatingItemTemplate,FooterTemplate,
9
10  //HeaderTemplate,,ItemTemplate,SeparatorTemplate)
11 if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
12 {
13 Repeater rep = e.Item.FindControl("rpquestionlist") as Repeater;//找到里层的repeater对象
14 DataRowView rowv = (DataRowView)e.Item.DataItem;//找到分类Repeater关联的数据项
15 int typeid = Convert.ToInt32(rowv["qtid"]); //获取填充子类的id
16 rep.DataSource = LiftQuestionCtr.GetSomeQuestionsByTypeid(typeid, 2);
17 rep.DataBind();
18 }
19 }

 

 

posted @ 2010-07-24 12:08  零纪录  阅读(366)  评论(0编辑  收藏  举报