private void dgList_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{

if (e.Item.ItemIndex>-1)
{

e.Item.Attributes.Add("onmouseover","this.setAttribute('BKC',this.style.backgroundColor); this.style.cursor='hand';this.style.backgroundColor='#dddddd'");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=this.getAttribute('BKC');");
}

}

解决方案 »

  1.   

    e.Item.Attributes.Add("onmouseover", "if (this.style.backgroundColor!='blue'){this.style.backgroundColor='Silver'}");  
    e.Item.Attributes.Add("onmouseout", "if (this.style.backgroundColor!='blue'){this.style.backgroundColor='White'}");
      

  2.   

    真不知道为什么MS不把它内置到DataGrid中去!!
      

  3.   

    为什么ItemDataBound执行不了
    需要设置datagrid的什么属性??
      

  4.   

    为什么ItemDataBound执行不了
    需要设置datagrid的什么属性??
    -----------------------------------------
    事件没绑定,看看小闪电的那个属性筐,一般很容易因为动了一下修改了一下aspx页面界面,事件绑定就脱钩了。tmd,微软的比MM的在界面方面不只是差一截哇。不过还是喜欢用,哈哈哈,两个一起用,一个冬瓜一个白菜,你说喜欢谁呢?