c#表格序号列
<asp:BoundField HeaderText="序号" /> OnRowCreated="gridview_RowCreated" protected void gridview_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex > -1) { if (datainfo != null && datainfo.Rows.Count > 0) { e.Row.Cells[0].Text = Convert.ToString(e.Row.RowIndex+1); } } }