您的位置:首页 > 其它

DataList显示行号的三种方法

2008-11-10 15:39 260 查看
1. if you are using SQL Server, try

程序代码
select identity(int,1,1) as 'id', * into #mytemp from YourTable
select * from #mytemp

2. you could add a column to the 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 %>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: