我有一个DataList
由DataTable
.
<asp:PlaceHolder ID="ph3" runat="server">
<asp:DataList ID="dlspec" runat="server" GridLines="Vertical" OnItemDataBound="dlspec_ItemDataBound">
<FooterStyle BackColor="#CCCCCC" />
<AlternatingItemStyle CssClass="alt-grey" />
<SelectedItemStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<ItemTemplate>
<table width="320px">
<tr>
<td class="leftcol">
<asp:Label ID="lblDimension" runat="server" Text='<%# Eval("Dimension") %>'></asp:Label>:
</td>
<td class="ProductDetailData">
<asp:Label ID="lblName" runat="server" Text='<%# Eval("Attribute") %>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</asp:placeholder>
问题是我只需要显示数据列表中的前 5 个元素,我需要隐藏其余的单元格并根据要求使它们“可扩展”。如何在 DataList 控件中实现这一点?我知道有一些 JQuery 插件可以针对特定的“div”标签使用来实现这一点,但我不知道如何在“DataList 控件”中做到这一点。
很快就需要帮助。感谢您的所有宝贵建议。