ASP.NET 一个Repeater 嵌套的问题
protectedvoidRaProduct_ItemDataBound(objectsender,RepeaterItemEventArgse){if(e.Item.I...
protected void RaProduct_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Repeater rep = e.Item.FindControl("r1") as Repeater;
DataRowView rowv = (DataRowView)e.Item.DataItem;
string id = rowv["id"].ToString();
rep.DataSource = pbll.GetAllProducts(id);
rep.DataBind();
}
}
RaProduct有3条数据 r1 为什么一条数据要循环显示3次 就是显示3个相同的子数据 求解 展开
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Repeater rep = e.Item.FindControl("r1") as Repeater;
DataRowView rowv = (DataRowView)e.Item.DataItem;
string id = rowv["id"].ToString();
rep.DataSource = pbll.GetAllProducts(id);
rep.DataBind();
}
}
RaProduct有3条数据 r1 为什么一条数据要循环显示3次 就是显示3个相同的子数据 求解 展开
展开全部
int sortid = Convert.ToInt32(((Label)e.Item.FindControl("lblTempId")).Text.ToString());\\在页面上放一个label 绑定id
Repeater ReDetail2 = (Repeater)e.Item.FindControl("Repeater2");
DataTable dt = stm.GetSubTypeById(sortid);
ReDetail2.DataSource = dt;
ReDetail2.DataBind();
这么写试试
Repeater ReDetail2 = (Repeater)e.Item.FindControl("Repeater2");
DataTable dt = stm.GetSubTypeById(sortid);
ReDetail2.DataSource = dt;
ReDetail2.DataBind();
这么写试试
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询