在datagrid的每一行显示当前数据的序号,可以不在数据库中通过临时表的自增列来实现,在datagrid里新建一个模板列,模板列内写上以下代码即可:

 

1 <asp:TemplateColumn HeaderText="序号">
2                         <ItemStyle HorizontalAlign="Center"></ItemStyle>
3                         <ItemTemplate>
4                             <%# Convert.ToString(Container.ItemIndex+1)%>
5                         </ItemTemplate>
6                     </asp:TemplateColumn>

相关文章:

  • 2021-12-28
  • 2021-07-15
  • 2022-02-01
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2021-07-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案