【Asp.Net】在DataGrid里添加行脚本代码的方法

代码填写在DataGrid的ItemDataBound事件里:

1if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
2        {
3            e.Item.Attributes["OnMouseOver"= "style.cursor='hand'; style.backgroundColor='yellow';";
4            e.Item.Attributes["OnMouseOut"= "style.backgroundColor='white';";
5            e.Item.Attributes["OnClick"= "window.open('aaa.aspx');";
6        }

行3语句:鼠标指到行时,鼠标变手型,行的底色变为黄色
行4语句:鼠标离开行时,行的底色变为白色
行5语句:鼠标单击时,弹出网页
posted @ 2006-07-06 00:30  柴火  阅读(696)  评论(0编辑  收藏  举报