在GridView中想在行上增加鼠标动作? 用css控制是王道!在页面上的<body >里面加上onmouseover事件的处理函数就可以了。因为你不可能将你系统里所有的datagrid都加这些代码吧 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 事件加错了,应该是rowbound事件里 tr里好像是没有效果的样。你放在td里看看呢? protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataKey key = GridView1.DataKeys[e.Row.RowIndex]; //鼠标经过时,行背景色变 e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E6F5FA'"); //鼠标移出时,行背景色变 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'"); Image img = (Image)e.Row.Cells[1].FindControl("Image1"); if (key["Lock_Man"].ToString() == string.Empty) { img.ImageUrl = "~/images/unlock.gif"; img.ToolTip = "未保护"; } else { img.ImageUrl = "~/images/lock.gif"; img.ToolTip = "已保护"; } } } for(int i=0;i<e.Row.Cells.Count;i++){e.Row.Cells[i].Attributes.Add("onmouseover","this.style.backgroudColor='#5D7C21';");e.Row.Cells[i].Attributes.Add("onmouseout","this.style.backgroudColor='#D91A01';");}这样加是加到tr上面改变tr的样式看不出来的 急求 发送短信到手机的 asp.net 源代码 在线等。。。。 各位大侠。帮我看看这程序出现了什么问题。。? ViewState的问题 Repeater控件的用发 请教HoverMenuExtender 显示内容被别的层遮盖 有没有.net2.0的持久层框架啊! 急救:关于.NET的安装,注册 datalist中的数据绑定问题 简单问题:关于asp和asp.net的问题。 窗口使用Panel控件问题,急.... gridview中的一个删除问题 C#或ASP.NET如何调用Tuxedo接口?
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataKey key = GridView1.DataKeys[e.Row.RowIndex];
//鼠标经过时,行背景色变
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E6F5FA'");
//鼠标移出时,行背景色变
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
Image img = (Image)e.Row.Cells[1].FindControl("Image1");
if (key["Lock_Man"].ToString() == string.Empty)
{
img.ImageUrl = "~/images/unlock.gif";
img.ToolTip = "未保护";
}
else
{
img.ImageUrl = "~/images/lock.gif";
img.ToolTip = "已保护";
}
}
}
{
e.Row.Cells[i].Attributes.Add("onmouseover","this.style.backgroudColor='#5D7C21';");
e.Row.Cells[i].Attributes.Add("onmouseout","this.style.backgroudColor='#D91A01';");
}
这样加是加到tr上面
改变tr的样式看不出来的