Chinaunix首页 | 论坛 | 博客
  • 博客访问: 588315
  • 博文数量: 64
  • 博客积分: 7040
  • 博客等级: 少将
  • 技术积分: 1299
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-09 20:38
文章存档

2012年(1)

2011年(8)

2010年(16)

2009年(18)

2008年(21)

我的朋友

分类:

2008-10-14 11:48:00

如下图所示:

核心代码:

private void grdCustomer_ItemDataBound(object sender,

         System.Web.UI.WebControls.DataGridItemEventArgs e)

{

     if(e.Item.ItemType == ListItemType.AlternatingItem ||

              e.Item.ItemType == ListItemType.Item )

     {

e.Item.Attributes.Add("onmouseover", "this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='#C8F7FF'");

        e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=this.oldcolor");

          for (int i = 0; i< grdCustomer.Columns.Count; i++ )

              {

                   e.Item.Cells[i].Attributes.Add("onmouseover",

          "this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='#99ccff'");

                   e.Item.Cells[i].Attributes.Add(

                       "onmouseout", "this.style.backgroundColor=this.oldcolor");

              }

     }

}

阅读(1111) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~