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(); 

            }

 }

你可能感兴趣的:(绑定)