我正在尝试使用它将行颜色更改为白色
row.cells[1].css('background-color', '#B3B3B3');
我收到错误
未捕获的类型错误:row.cells[1].css 不是函数
实现这种恢复的适当方法是什么?
如果要
更改代码隐藏的颜色,请使用属性。
row.cells[1].Attributes.Add("style", "background-color: #B3B3B3");
或分配课程
row.Cells[1].CssClass = "myClass";
<style>
.myClass {
background-color: #B3B3B3
}
</style>
更新
因此,如果您想单击按钮即可使用它,请像这样操作
protected void Button1_Click(object sender, EventArgs e)
{
GridView1.Rows[1].Cells[1].CssClass = "myClass";
}