跟小D每日学口语

datalist显示行号的三种方法

1. if you are using SQL Server, try //在你的SQL语句里添加select identity(int,1,1) as 'id', * into #mytemp from YourTable
select * from #mytemp
2. you could add a column to the DataTable: 在datatable里添加一行DataTable1.Columns.Add("ID",typeof(int));
int i=0;
foreach (DataRow dr in DataTable1.Rows)
{
    dr["ID"] = ++i;
}
3. or you can use in your template 在模板上添加<%# Container.ItemIndex+1 %>
posted @ 2009-05-09 12:24  腐乳  阅读(711)  评论(0编辑  收藏  举报