日期:2014-05-19  浏览次数:20896 次

背景颜色的设定
在后台如何定义gridview的某一行的背景颜色

------解决方案--------------------
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (在这里写要加背景的行的条件)
{
e.Row.Attributes.Add( "style ", "background-image:url( 'background.gif ') ");
}
}
------解决方案--------------------
//i行,红色
this.dataGridView1.Rows[iRow].DefaultCellStyle.BackColor = Color.Red;