首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

gridview 高亮显示鼠标所在行的有关问题

2012-11-04 
gridview 高亮显示鼠标所在行的问题C# codeprotected void GridView1_RowDataBound(object sender, GridVi

gridview 高亮显示鼠标所在行的问题

C# code
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)    {        if (e.Row.RowType == DataControlRowType.DataRow)        {            e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");            e.Row.Attributes.Add("onmouseout", "this.style.backrgoundColor=currentcolor;");            //e.Row.Cells[3].Text = (Convert.ToSingle(e.Row.Cells[3].Text)).ToString("F2");            //e.Row.Cells[3].Text = string.Format("{0:F2}", Convert.ToDouble(e.Row.Cells[3].Text));                   }


这个可以实现 高亮  

但是有一个问题, 你在移动到其他行的时候, 其他行也亮,但是前一行 也亮 没有变回原来的原色。 麻烦告知原因 谢谢

[解决办法]
C# code
e.Row.Attributes["onmouseover"] = "e=this.style.backgroundColor;this.style.backgroundColor='#6699ff'";e.Row.Attributes["onmouseout"] = "this.style.backgroundColor=e";
[解决办法]
refer:



http://www.cnblogs.com/insus/articles/1411057.html
http://www.cnblogs.com/insus/archive/2011/06/25/2090071.html
http://www.cnblogs.com/insus/archive/2011/10/17/2215637.html

热点排行