木子屋 Dnawo's BLOG

DataList显示行号的三种方法

👤 dnawo 📅 2008-10-16 👁 4541 👍 0 💬 0 🔄 百度空间
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 %>

评论(0)

暂无评论。

计算题
评论需审核通过后显示
← 上一篇 Sony Ericssion K750c文件管理 下一篇 → 如何编写兼容各主流邮箱的HTML邮件