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);
}
}
        }

  

posted @ 2021-09-05 20:35  刘贵庆  阅读(74)  评论(0编辑  收藏  举报