本文介绍了gridview选择了行颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! Hii 在我的项目中,我在gridview行的鼠标悬停时打开功能区菜单,并且还更改了所选的行颜色,但我不会设置所选的行颜色常量如果鼠标转到那个功能区菜单内容 如何做到这一点...... 我使用以下代码为此 private void SetGridRows(GridView gvMycust) { int iRowCount = 0 ; foreach (GridViewRow gr in gvMycust.Rows) {标签lblName =(标签)gr.FindControl( custid); string id = lblName.Text; string sClass = ListNorRow; if (iRowCount == 1 ) { sClass = ListAltRow; } gr.Attributes.Add( onmouseout , javascript:this.className =' + sClass + '); gr.Attributes.Add( onmouseover, ShowPopup(' + id + ');使用JavasScript:this.className =' ListSelRow';); gr.Attributes.Add( OnClick, HideContent('SubMenu');); iRowCount = iRowCount == 0 ? 1 : 0 ; } } 解决方案 HiiIn my project I am open ribbon menu on mouseover of gridview row and also change selected row color but I won't to set selected row color constant if mouse goes to that ribbon menu contenthow to do this ......I use following code for thisprivate void SetGridRows(GridView gvMycust) { int iRowCount = 0; foreach (GridViewRow gr in gvMycust.Rows) { Label lblName = (Label)gr.FindControl("custid"); string id = lblName.Text; string sClass = "ListNorRow"; if (iRowCount == 1) { sClass = "ListAltRow"; } gr.Attributes.Add("onmouseout", "javascript:this.className='" + sClass + "'"); gr.Attributes.Add("onmouseover", "ShowPopup('" + id + "');javasscript:this.className='ListSelRow';"); gr.Attributes.Add("OnClick", "HideContent('SubMenu');"); iRowCount = iRowCount == 0 ? 1 : 0; } } 解决方案 这篇关于gridview选择了行颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-05 06:05