怎么设置当鼠标点击GridView某一行时,那么这行显示底色为黄色,当鼠标点击GridView另一行时,上次点击的那行底色还原为以前的颜色,被点击的行底色设置为黄色.
解决方案 »
- C#关于多用户的问题(例如论坛、新闻系统)?
- 关于DataGridView中每单击某一行就弹出一个信息窗的问题
- 用PPC 模拟器 socket 连接 速度慢。
- 提几个问题!
- 关于窗体设计时,Language属性的使用问题
- 在C#开发的B/S系统中,请问如何判断当前操作的用户是客户端还是服务器端??在线等!
- 关于saveFileDialog的小问题
- C# 如何吧app.config配置文件封装到dll文件中?
- 关于工资计算公式的问题,关于工资计算公式的问题
- Java PKCS8EncodedKeySpec 签名怎么转化为C#代码?
- 急,在线等,高手指导一下,FtpWebRequest 上传大文件出问题
- treeview click事件的一点小疑问
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Attributes["onclick"] = "var rows=this.parentNode.rows;for(var i=0;i<rows.length;i++)rows[i].style.background='white';this.style.background='yellow';";
}
CurrentRow.BackColor
var oldClr;
function chgClr(obj){
var rows;
oldClr=obj.style.backgroundColor;
rows=this.parentNode.rows;
for(var i=0;i<rows.length;i++){
rows[i].style.backgroundColor=oldClr;
obj.style.backgroundColor='yellow';
}
}
</script>protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Attributes.Add["onclick","chgClr(this)"];
}
http://dotnet.aspx.cc/file/Change-GridView-Row-Background-Color-When-Click-Row.aspx
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// 给单元格增加鼠标经过时指针样式
e.Row.Attributes["style"] += "cursor:pointer;cursor:hand;";
ViewState["GVCurrentRow"] = e.Row.RowIndex;
int intRowIndex = e.Row.RowIndex;
//intRowIndex = intRowIndex;
//当鼠标停留时更改背景色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#9DA2F7'");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c"); e.Row.Attributes.Add("onClick", "javascript:__doPostBack('" + gvShowPlanInfor.ID + "','Select$" + intRowIndex + "');");
}
}