8,833
社区成员
发帖
与我相关
我的任务
分享
public class MyGridView:GridView
{
public MyGridView()
{
//构造函数
}
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
base.Render(writer);
}
protected override void OnRowDataBound(GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#99cc00';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;");
}
base.OnRowDataBound(e);
}
protected override void OnRowCreated(GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
TableCellCollection tcHeader = e.Row.Cells;
tcHeader.Clear();
}
base.OnRowCreated(e);
}
}