GridView专栏
鉴于GridView的强大,鄙人突然心血来潮,想把GridView单独拿出来整理一下。
(一)gridview如何加自增长列
1 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 2 { 3 if (e.Row.RowIndex != -1) 4 { 5 int indexID = this.GridView1.PageIndex * this.GridView1.PageSize + e.Row.RowIndex + 1; 6 e.Row.Cells[0].Text = indexID.ToString(); 7 } 8 }