GridView 点击行的任意处触发选择事件
protected override void Render(HtmlTextWriter writer) { foreach (GridViewRow row in GridView1.Rows) { if (row.RowType == DataControlRowType.DataRow) { row.Attributes["onclick"] = ClientScript.GetPostBackEventReference(GridView1, "Select$" + row.RowIndex.ToString(), true); row.Attributes["style"] = "cursor:pointer"; row.Attributes["title"] = "单击选择行"; row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'"); row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor"); } } base.Render(writer); }