日期:2014-05-18 浏览次数:20936 次
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "1") e.CellStyle.BackColor = Color.Red; }
------解决方案--------------------
e.Row.Attributes.Add("onclick", "if(window.oldtr!=null){window.oldtr.runtimeStyle.cssText='';}this.runtimeStyle.cssText='background-color:#e6c5fc';window.oldtr=this");
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#B2DFEE'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
使用于asp.net IE