protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string id = gv.DataKeys[e.Row.RowIndex].Value.ToString();
Label label2 = (Label)(e.Row.FindControl("Label2")); //Label2是要修改的那个控件名
if (label2.Text == 1)
{
label2.Text = "管理员";
}
}
}
用Gridview控件的RowDataBound事件