62,046
社区成员
发帖
与我相关
我的任务
分享
protected void gv_Attendance_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowIndex > 0)
{
Label lbl0 = e.Row.Cells[0].FindControl("Label1") as Label;//当前行控件
Label lbl1 = this.gv_Attendance.Rows[e.Row.RowIndex-1].Cells[0].FindControl("Label1") as Label;//上一行控件
if (lbl0.Text == lbl1.Text)//如果本行此单元格内容和上面的内容相同
{
。。。。。。//这里使用lbl0.Text可以获取值,使用e.Row.Cells[0].Text怎么都是"",
。。。。。。//普通列,比如e.Row.Cells[1].Text却有值
}
}
}