i have used this code.and it shows an error: Dim row As GridViewRow = CType(CType(e.CommandSource, Control).NamingContainer, GridViewRow)
The error is as folows:
An exception of type ‘System.InvalidCastException’ occurred in FFK.DLL but was not handled in user code
Additional information: Unable to cast object of type ‘System.Web.UI.WebControls.ContentPlaceHolder’ to type ‘System.Web.UI.WebControls.GridViewRow’.
I am assuming that what you want is the index of the selected row of a GridView?
If so, you can try something like:
… This will give you the zero-based index position of the row in the GridView.
Hope this helps,