















项目需求内容列表必须有规则的序号,而数据库中的主键又不是连续的,所以只能人为添加上去。
DataList的编号是从0开始,所以用以下代码:
<asp:Label ID="lblQNum" runat="server" Text='<%# Container.ItemIndex+1 %>' Font-Bold="True"></asp:Label>
GridView也类似,稍微有点点不同,用的是:DataItemIndex
<asp:Label ID="lblSNum" runat="server" Text='<%# Container.DataItemIndex+1 %>'></asp:Label>
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。