protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
int i;
//执行循环,保证每条数据都可以更新
for (i = 0; i < GridView2.Rows.Count; i++)
{
//首先判断是否是数据行
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标停留时更改背景色
e.Row.Attributes.Add("onmouseover", "function(){this.style.backgroundImage='url('../image/itemActive.png')';}");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "function(){this.style.backgroundImage='url()';}"); }
}
}
onselectedindexchanged="GridView2_SelectedIndexChanged" ShowHeader="False"
Width="142px" GridLines="None" Height="87px">
DataNavigateUrlFormatString="新闻中心.aspx?classid={0}"
DataTextField="class_name" HeaderText="类别列表" />
取消
评论