我想让gridview行可选。我不喜欢用户点击网格上的按钮或链接来选择行的想法。如何给行实际行命令?
答案 0 :(得分:1)
您就是这样做的。
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);
}
}