//Gridview 分页中设置编号列  
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //自动编号 e.Row.Cells[4].Text = (float.Parse(e.Row.Cells[4].Text)*100).ToString(); int index = e.Row.RowIndex;//获取当前点击前的行号 if (index % 2 == 0) { e.Row.BackColor = GetRgbColor("#ededed"); ; } }
<asp:TemplateField HeaderText="自增列" FooterText="自增列">     
  <ItemTemplate>              
    <%# (Container.DataItemIndex+1).ToString()%>         
  </ItemTemplate> </asp:TemplateField>

 

 

 

相关文章:

  • 2021-10-19
  • 2021-11-17
  • 2022-03-02
  • 2021-08-30
  • 2021-07-04
  • 2022-02-19
猜你喜欢
  • 2022-12-23
  • 2021-12-22
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2022-03-03
相关资源
相似解决方案