I want to make my gridview rows selectable. I don't like the idea of a user clicking a button or link on the grid to select the row. How can I give the actual row a row command?
+1
A:
This is how you do it.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridView GridView1 = (GridView)frmViewClaimantPE.FindControl("GridView1");
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(GridView1, "Select$" + e.Row.RowIndex);
}
}
Eric
2009-12-28 16:27:50