C# Repeater两个控件嵌入问题!
<asp:RepeaterID="Repeater1"runat="server"><ItemTemplate><li><ahref="#Menu=ChildMenu<%...
<asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <li><a href="#Menu=ChildMenu<%# Eval("IntID") %>" onclick="DoMenu('ChildMenu<%# Eval("IntID") %>')"><%# Eval("Column_name")%></a> <ul id="ChildMenu<%# Eval("IntID") %>" class="collapsed"> <asp:Repeater ID="Repeater2" runat="server"> <ItemTemplate> <li><a href="#"><%# Eval("Column_name")%></a></li> </ItemTemplate> </asp:Repeater> </ul> </li> </ItemTemplate> </asp:Repeater> 错误,当前上下文中不存在名称“Repeater2”。
展开
展开全部
要看看你在后台是怎么给Repeater2绑定数据的,
这种嵌套的数据绑定
在Repeater1的Repeater1_ItemDataBound事件里面为子Repeater绑定
protected
void
Repeater1_ItemDataBound(object
sender,
RepeaterItemEventArgs
e)
{
Repeater
Child_Repeater
=
(Repeater)e.Item.FindControl("Repeater2");
DataSet
ds
=
new
DataSet();
//ds=
Child_Repeater.DataSource
=
ds;
Child_Repeater.DataBind();
}
这种嵌套的数据绑定
在Repeater1的Repeater1_ItemDataBound事件里面为子Repeater绑定
protected
void
Repeater1_ItemDataBound(object
sender,
RepeaterItemEventArgs
e)
{
Repeater
Child_Repeater
=
(Repeater)e.Item.FindControl("Repeater2");
DataSet
ds
=
new
DataSet();
//ds=
Child_Repeater.DataSource
=
ds;
Child_Repeater.DataBind();
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询