I have a row of buttons in a gridview that are created dynamically. When the button in a cell is clicked, the row disappears. Not sure why. Does anyone have a solution to this?
Here is my code:
Protected Sub GridView2_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
For Each cell As TableCell In e.Row.Cells
Dim lb As New Button()
lb.Text = "Apply"
lb.CommandName = "applicationlink"
AddHandler lb.Command, AddressOf button_Command
cell.Controls.Add(lb)
Next
End If
End Sub
Protected Sub button_Command(ByVal sender As Object, ByVal e As CommandEventArgs)
If e.CommandName = "applicationlink" Then
'This is to test
Dim lb As Button = DirectCast(sender, Button)
'lb.Text = "OK"
Response.Redirect("http://www..com")
End If
End Sub
Thanks