다시 색을 사용하여 모두를 설정할 수 있지만 격자보기에 다음과 같이 색상을 설정하여 텍스트를 설정할 수 있습니다. 성공 = 녹색, 프로세스 = 빨간색, 확인 = 노란색 감사합니다. .GridView의 색상 텍스트 설정 방법
protected void RowDataBound(Object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
// Retrieve the underlying data item. In this example
// the underlying data item is a DataRowView object.
DataRowView rowView = (DataRowView)e.Row.DataItem;
// Retrieve the state value for the current row.
String state = rowView["Label1"].ToString();
//format color of the as below
if(state == "Success")
(e.Row.FindControl("lbl1") as Label).BackColor = Color.Green;
if(state == "Process")
(e.Row.FindControl("lbl1") as Label).BackColor = Color.Rad;
if(state == "Verified")
(e.Row.FindControl("lbl1") as Label).BackColor = Color.Yellow;
}
}
중복? [템플릿 필드에있는 gridview 셀에서 ASP.NET 변경 텍스트 및 색상] (http://stackoverflow.com/q/15907217/456814). –