鼠标悬停GridView的行时相应的行变色,这一脚本这哪个事件中写
这不用在脚本中写呀,可以在DATAGRID中的ItemDataBound属性中写入:
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onmouseover","c=this.style.backgroundColor;this.style.backgroundColor='yellow'");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=c");
}