日期:2014-05-18  浏览次数:20494 次

GridView的问题,如何在单击一行任意处时触发SelectIndexChanged事件?
而不需要增加一个选择按钮?
thx.

------解决方案--------------------
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onclick"] = GridView1_SelectedIndexChanged(null, null);
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
...
}