想用repeater嵌套repeater做个2级菜单
我瞎写的代码
<div class="menu">
<ul>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSourceQuyu">
<ItemTemplate>
<li><a class="hide" href="###"><%# Eval("region")%></a>
<ul>
<asp:Repeater ID="Repeater2" runat="server" DataSourceID="SqlDataSourceQuyu2">
<ItemTemplate>
<li><a href="###"><%# Eval("province")%></a></li>
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSourceQuyu2" runat="server"
ConnectionString="<%$ ConnectionStrings:zidaiHaiyang %>"
SelectCommand='SELECT [RegionId], [ProductName], [province] FROM [RegionProduct] where [RegionId] =<%# Eval("id")%>' ></asp:SqlDataSource>
//我想根据上一级的id查到此
</ul>
</li>
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSourceQuyu" runat="server"
ConnectionString="<%$ ConnectionStrings:zidaiHaiyang %>"
SelectCommand="SELECT * FROM [Region]"></asp:SqlDataSource>
</ul>
</div>