Repeater绑定数据后如何生成分组的数据,比较难这个问题。

Repeater 绑定数据后如何生成这样的数据
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
<ul>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
每隔三条数据就生成新的UL
数据的数量可能是1,6,7。。。不一定的。
如果是7条数据的话就生成
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
<ul>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
<ul>
<li>7</li>
</ul>

慕仙森
浏览 616回答 2
2回答

胡子哥哥

在业务里先把数据分好组,然后用两个Repeater 嵌套,

Cats萌萌

嵌套。两个Repeater进行嵌套。然后用数据源进行联动绑定。1 &nbsp;<asp:Repeater ID="Repeater1" runat="server"> 2 &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<ItemTemplate> 3 &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<ul> 4 &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<asp:Repeater ID="childRpt" runat="server" DataSourceID="ObjectDataSource1"> 5 &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<ItemTemplate> 6 &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<li></li> 7 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</ItemTemplate> 8 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</asp:Repeater> 9 &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"></asp:ObjectDataSource>10 &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</ul>11 &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</ItemTemplate>12 &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</asp:Repeater>
打开App,查看更多内容
随时随地看视频慕课网APP