Repeater二级绑定

protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Repeater rp = e.Item.FindControl("Repeater2") as Repeater;
                DataRowView rowv = (DataRowView)(e.Item.DataItem);
                //提取分类ID 
                string CategorieId = Convert.ToString(rowv["ClassId"]);
                //根据分类ID查询该分类下的产品,并绑定产品Repeater 
                DataSet ds = tcBLL.GetList("ClassPre='" + CategorieId + "'");
                rp.DataSource = ds.Tables[0].DefaultView;
                rp.DataBind();
                rp.Dispose();
                ds.Dispose(); 
            }
 }
posted @ 2012-06-05 18:20  Setme  阅读(167)  评论(0编辑  收藏  举报