How can I find the control in the row command of grid view?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Carriage Return (ASCII chr 13) is missing from tex
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
GridViewCommandEventArgs not supported row so use naming container to find the control..
You can use "CommandArgument" in your Control with "CommandName". Here 2 arguments :
Then in your code behind you can get arguments :
And now you arguments to find your controls :
GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer; int rowIndex = gvr.RowIndex;
Actually there is no Row in GridViewCommandEventArgs, so you will need to get the row from the command source naming container
then you will be able to use
Hope this helps!
if your using LinkButton