protected
void
Repeater1_RowDataBound(
object
sender, GridViewRowEventArgs e)
{
if
(e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add(
"onmouseover"
,
"this.style.backgroundColor='#9CD45B'"
);
e.Row.Attributes.Add(
"onmouseout"
,
"this.style.backgroundColor='#E6F6D0'"
);
}
}
protected void rpt_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
var tdProgress = e.Item.FindControl("tdProgress") as System.Web.UI.HtmlControls.HtmlTableRow;
tdProgress.Attributes.Add("ondblclick", string.Format("editProgress('{0}');", id));
tdProgress.Attributes.Add("onmouseover", "this.style.backgroundColor='#D3DEEF'");
tdProgress.Attributes.Add("onmouseout", "this.style.backgroundColor='#ffffff'");
}
}
在Repeater中的TR里写JS
< tr onmouseover="Fuscous(this)" onmouseout="Undertone(this)">
< td></td>
< tr>
// 颜色加深
function Fuscous(obj)
{
obj.style.backgroundColor='#D3DEEF';
}
//颜色恢复为白色
function Undertone(obj)
{
obj.style.backgroundColor='#ffffff';
}