gridview获取某行某列值出现问题
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
for (int i = 0; i < GridView1.Rows.Count ; i++)
{
if (GridView1.Rows[i].Cells[1].Text == "admin")
{
GridView1.Rows[i].Cells[1].ForeColor = System.Drawing.Color.Black;
}
else
{
Response.Write(this.GridView1.Rows[i].Cells[1].Text.ToString());
//Response.Write(GridView1.Rows[i].Cells[0].Text);
GridView1.Rows[i].Cells[1].ForeColor = System.Drawing.Color.Red;
}
}
}
//Response.Write(this.GridView1.Rows[i].Cells[1].Text.ToString()); 这里所输出的值为空,
也就是说this.GridView1.Rows[i].Cells[1].Text.ToString()没有值,这是怎么回事,好像获取不到值。