GirdView中怎么设置某个按钮让所在行的颜色变掉 http://www.cnblogs.com/Far/archive/2008/05/15/1197557.html这里你能找到答案 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { int i; //执行循环,保证每条数据都可以更新 for (i = 0; i < GridView1.Rows.Count; i++) { //首先判断是否是数据行 if (e.Row.RowType == DataControlRowType.DataRow) { //当鼠标停留时更改背景色 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'"); //当鼠标移开时还原背景色 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c"); } } }你变通一下就得到了 GridView里边不是有个选择吗另外http://www.cnblogs.com/Far/archive/2008/05/15/1197557.html ,这个里边你可以看下,可以让鼠标经过变色 //单击行改变行背景颜色 if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onclick", "this.style.backgroundColor='#99cc00'; this.style.color='buttontext';this.style.cursor='default';"); } <script type="text/javascript"> var oldRow; function ChangeColor(row) { if(oldRow != undefined) { oldRow.style.backgroundColor="#FFFFFF"; } oldRow = row; row.style.backgroundColor="#7788CC"; }</script><asp:TemplateField> <ItemTemplate> <a href="#" onclick="ChangeColor(this.parentNode.parentNode)">ChangeColor</a> </ItemTemplate></asp:TemplateField>没必要使用服务器控件LinkButton,直接使用超级连接即可,因为是在客户端该变颜色。 多线程的程序vs里无法断点调试啊 关于二维数组/treeview节点的赋值问题. 关于 ActiveReports 请教console的问题,sleep 之后需要在键盘上按键才能显示,如何做到直接在console中显示结果而不需要再按键?付代码 IEnumerable.GetEnumerator 方法 装箱和拆箱问题. 如何把二进制写入word文档? c# 串口通信问题,不好意思,没有分送了 单指令单数据流...到底是哪一个分支下的知识 C# frameset 前辈们:究竟什么是抽象类? FTP上传文件问题
{
int i;
//执行循环,保证每条数据都可以更新
for (i = 0; i < GridView1.Rows.Count; i++)
{
//首先判断是否是数据行
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标停留时更改背景色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
}
} }
你变通一下就得到了
另外http://www.cnblogs.com/Far/archive/2008/05/15/1197557.html ,这个里边你可以看下,可以让鼠标经过变色
//单击行改变行背景颜色
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "this.style.backgroundColor='#99cc00'; this.style.color='buttontext';this.style.cursor='default';");
}
var oldRow;
function ChangeColor(row)
{
if(oldRow != undefined)
{
oldRow.style.backgroundColor="#FFFFFF";
}
oldRow = row;
row.style.backgroundColor="#7788CC";
}
</script>
<asp:TemplateField>
<ItemTemplate>
<a href="#" onclick="ChangeColor(this.parentNode.parentNode)">ChangeColor</a>
</ItemTemplate>
</asp:TemplateField>没必要使用服务器控件LinkButton,直接使用超级连接即可,因为是在客户端该变颜色。