gridview鼠标移动到某行高亮显示
By:Roy.LiuLast updated:2008-10-16
在gridview中的 rowdatabound事件中,为行增加JAVASCRIPT属性。
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//高亮显示指定行
e.Row.Attributes.Add("onMouseOver", "Color=this.style.backgroundColor;this.style.backgroundColor='#FFF000'");
e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=Color;");
//设置审核状态,并且设置相应的颜色。
if (e.Row.Cells[5].Text == "False")
{
e.Row.Cells[5].Text ="未审核";
}
else
{
e.Row.Cells[5].Text = "已审核";
}
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//高亮显示指定行
e.Row.Attributes.Add("onMouseOver", "Color=this.style.backgroundColor;this.style.backgroundColor='#FFF000'");
e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=Color;");
//设置审核状态,并且设置相应的颜色。
if (e.Row.Cells[5].Text == "False")
{
e.Row.Cells[5].Text ="未审核";
}
else
{
e.Row.Cells[5].Text = "已审核";
}
}
}
From:一号门
Previous:问君能有几多愁,恰似满仓中石油.
Next:repeater基本使用方法
COMMENTS