J
jobs
CommandArgument does not contain row index when command under
Templatefield of- Gridview
It appears CommandArgument passed to the rowcommand event does not
contain row index when the command is called from a control under a
Templatefield. Why is this not the case when the command is from a
Buttonfield for example. And, if this so, how can I get the index of
the row executing the command. This code works for Buttonfield under
the rowcommand event, but fails for Templatefield buttons under the
same gridview.
Dim grid As GridView = CType(sender, GridView)
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim row As GridViewRow = grid.Rows(index)
Templatefield of- Gridview
It appears CommandArgument passed to the rowcommand event does not
contain row index when the command is called from a control under a
Templatefield. Why is this not the case when the command is from a
Buttonfield for example. And, if this so, how can I get the index of
the row executing the command. This code works for Buttonfield under
the rowcommand event, but fails for Templatefield buttons under the
same gridview.
Dim grid As GridView = CType(sender, GridView)
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim row As GridViewRow = grid.Rows(index)