核心代码:
private void grdcustomer_itemdatabound(object sender,
system.web.ui.webcontrols.datagriditemeventargs e)
{
if(e.item.itemtype == listitemtype.alternatingitem ||
e.item.itemtype == listitemtype.item )
{
e.item.attributes.add("onmouseover", "this.oldcolor=this.style.backgroundcolor;this.style.backgroundcolor='#c8f7ff'");
e.item.attributes.add("onmouseout", "this.style.backgroundcolor=this.oldcolor");
for (int i = 0; i< grdcustomer.columns.count; i++ )
{
e.item.cells[i].attributes.add("onmouseover",
"this.oldcolor=this.style.backgroundcolor;this.style.backgroundcolor='#99ccff'");
e.item.cells[i].attributes.add(
"onmouseout", "this.style.backgroundcolor=this.oldcolor");
}
}
}
新闻热点
疑难解答