您的位置:首页 > 其它

datalist显示行号的三种方法

2008-11-22 12:51 274 查看
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 %>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: