When you click a row in the gridview control, the selectedindexchanging event is not triggered. What should you do when you want to trigger the selectedindexchanging event when you click it?
I did this:
Bind an event to the row of the gridview
Rowdatabound (Object sender, gridviewroweventargs E)
If (E. Row. rowtype = datacontrolrowtype. datarow)
{
E. Row. attributes ["style"] = "cursor: Hand ";
# Region // click a row to trigger the selectedindexchanged event
Postbackoptions mypostbackoptions = new postbackoptions (this );
Mypostbackoptions. autopostback = false;
Mypostbackoptions. Required mvalidation = 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
}
After adding this, the selectedindexchanging event can be triggered when the row is clicked.