Hello.
Can anyone here please explain to be the function of this line of codes?
GridViewRow row = (GridViewRow)((Control)e.CommandSource).Parent.Parent;
what does each word mean?
especially these
-Control
-commandsource
.parent
.parent
and what does this return?
Thanks and have a nice day
Loading
Abhay ShankerPosted Apr 3, 2014, 4:54 AM
Above code is used when we want to obtain rowindex of the control which fired the RowCommand
Control:-Generally gridview row control like LinkButton or checkbox
-commandsource:-We use that in the ItemCommand of the DataCotnrol to get a reference to the control that causes the event to be fired(the button that was clicked by the user).
.parent:- Immediate parent like row or gridview