protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Pager)
{
return;
}
e.Row.Cells[0].Attributes.Add("style", "display: none;");
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='Red';this.style.cursor = 'hand';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor = c;");
e.Row.Attributes.Add("onclick", "javascript:__doPostBack('" + e.Row.FindControl("lbtnSelect").ClientID.Replace("_", "$") + "','')");
}
}
在加载行时隐藏第一列选择按钮.及为第一行加上样式.