不是嵌套Repeater拿Repeater另外一个隐藏
<asp:RepeaterID="rpeter_a"runat="server"><ItemTemplate><%#Eval("TypeName")%>#typeIds=...
<asp:Repeater ID="rpeter_a" runat="server" >
<ItemTemplate>
<%# Eval("TypeName")%>
# typeIds =(int)Eval("typeId")%>
</ItemTemplate>
</asp:Repeater>
<asp:Repeater ID="rpeter_a" runat="server" >
<ItemTemplate>
这个Repeater拿上面Repeater的ypeId
</ItemTemplate>
</asp:Repeater>
<asp:Repeater ID="rpeter_a" runat="server" >
<ItemTemplate>
<%# Eval("TypeName")%>
<% # typeIds =(int)Eval("typeId")%>
</ItemTemplate>
</asp:Repeater>
<asp:Repeater ID="rpeter_a" runat="server" >
<ItemTemplate>
这个Repeater拿上面Repeater的typeId
</ItemTemplate>
</asp:Repeater> 展开
<ItemTemplate>
<%# Eval("TypeName")%>
# typeIds =(int)Eval("typeId")%>
</ItemTemplate>
</asp:Repeater>
<asp:Repeater ID="rpeter_a" runat="server" >
<ItemTemplate>
这个Repeater拿上面Repeater的ypeId
</ItemTemplate>
</asp:Repeater>
<asp:Repeater ID="rpeter_a" runat="server" >
<ItemTemplate>
<%# Eval("TypeName")%>
<% # typeIds =(int)Eval("typeId")%>
</ItemTemplate>
</asp:Repeater>
<asp:Repeater ID="rpeter_a" runat="server" >
<ItemTemplate>
这个Repeater拿上面Repeater的typeId
</ItemTemplate>
</asp:Repeater> 展开
1个回答
展开全部
protectedvoid rptMenu_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Repeater rpt = e.Item.FindControl("rptSonMenu") as Repeater;//找到里层的repeater对象
rpt.ItemDataBound+=new RepeaterItemEventHandler(rpt_ItemDataBound);
rpt.ItemCommand += new RepeaterCommandEventHandler(rpt_ItemCommand);
DataRowView rowv = (DataRowView)e.Item.DataItem;//找到分类Repeater关联的数据项 int ID = Convert.ToInt32(rowv["ID"]); //获取填充子类的id
rpt.DataSource = meBLL.SelectSonMenu(ID);
rpt.DataBind();
}
}
其实就是 Repeater 嵌套 ,内层Repeater 数据绑定是 获取上层 的数据
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Repeater rpt = e.Item.FindControl("rptSonMenu") as Repeater;//找到里层的repeater对象
rpt.ItemDataBound+=new RepeaterItemEventHandler(rpt_ItemDataBound);
rpt.ItemCommand += new RepeaterCommandEventHandler(rpt_ItemCommand);
DataRowView rowv = (DataRowView)e.Item.DataItem;//找到分类Repeater关联的数据项 int ID = Convert.ToInt32(rowv["ID"]); //获取填充子类的id
rpt.DataSource = meBLL.SelectSonMenu(ID);
rpt.DataBind();
}
}
其实就是 Repeater 嵌套 ,内层Repeater 数据绑定是 获取上层 的数据
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询