I'm having the following problem deleting a line from asp:gridview
.
When I leave the code (key) visible="false"
in gridview
, the value returned in my variable Delete key comes empty . But when I leave visible="true"
the function takes the correct value, does anyone know of a solution to get the value even with visible="false"
of my key?
Protected Sub gvLivros_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles gvLivros.RowCommand
Dim objLivros As New ClasseLivros
If e.CommandName = "Excluir" Then
Dim index As Integer = Integer.Parse(DirectCast(e.CommandArgument, String))
Dim chaveDelete = gvLivros.Rows(index).Cells(0).Text
objLivros.ExcluirLivro(Convert.ToInt32(chaveDelete))
End If
End Sub