Gridview中显示的值根据数据库中带出的值作更改

前台页面对Gridview增加事件 OnRowDataBound="GridView1_RowDataBound"
protected
void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.Cells[4].Text.Trim() == " ") e.Row.Cells[4].Text = "未签核"; else if (e.Row.Cells[4].Text.Trim() == "AP") { e.Row.Cells[4].Text = "被否决"; } else { e.Row.Cells[4].Text = "使用中"; } } }
原文地址:https://www.cnblogs.com/vichin/p/6282100.html