if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //鼠标经过时的背景色,此处c用于记录原来的颜色
            e.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#eee';");
            //鼠标移开时将背景色设回原来的颜色
            e.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
        } 
在后寫了這麼語句,怎么提示system.xml.linq.xname是方法,這在給定的內容無效啊,謝

解决方案 »

  1.   

    参考这个试试
     if (e.Row.RowType == DataControlRowType.DataRow)
                {                
                    System.Drawing.Color cl;
                    e.Row.Attributes.Add("onmouseover", "cl=this.style.backgroundColor;this.style.backgroundColor='#E6F5FA'");               
                    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=cl");
                }
      

  2.   

    system.xml.linq.xname明显与你给出的程序无关啊
    先注释掉你新添加的地方看看还有没有这个错了