日期:2014-05-18 浏览次数:20515 次
38 protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) 39 { 40 if (e.Row.RowType == DataControlRowType.DataRow) 41 { 42 string Salary = e.Row.Cells[3].Text.ToString(); 43 if (Convert.ToDouble(Salary.Substring(1)) > 2000.00) 44 { 45 e.Row.BackColor = System.Drawing.Color.Orange; 46 } 47 } 48 }
------解决方案--------------------
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.BackColor = Color.FromName("Red");//此处的Red替换成你从数据库中取的值 } }
------解决方案--------------------
看了楼上的,改一下
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
GridView1.RowStyle.BackColor = System.Drawing.Color.FromName(DropDownList1.SelectedValue);
}