1. Add enableeventvalidation= "false" to <% @Page ...%> directive
2. Add in the RowDataBound event
protected void GridView1_RowDataBound (object sender, GridViewRowEventArgs e)
{
Switch (e.row.rowtype)
{
Case Datacontrolrowtype.datarow:
e.row.attributes["style"] = "Cursor:hand";
#region//Click line to trigger the SelectedIndexChanged event
PostBackOptions mypostbackoptions = new PostBackOptions (this);
Mypostbackoptions.autopostback = false;
Mypostbackoptions.performvalidation = false;
Mypostbackoptions.requiresjavascriptprotocol = true; Add javascript: Header
String evt = Page.ClientScript.GetPostBackClientHyperlink (sender as GridView, "select$" + e.row.rowindex.tostring ());
E.row.attributes.add ("onclick", evt);
#endregion
Break
}
}
3, after the 12th step, you can add the processing logic in the selectedindexchanging and SelectedIndexChanged events.
GridView Click Line Trigger SelectedIndexChanged Event