I'm dynamically creating buttons for pagination that should be calling an event handler when clicked. The postback is happening, however it never hits the event sub. This is my button creation code (i = 0):
Do While (i < pages)
Dim btn As New Button With {
.Text = (i).ToString,
.CommandArgument = (i).ToString,
.ID = "btnGrdPage_" + (i).ToString
}
AddHandler btn.Click, AddressOf Me.btnGrdParticipantPage_Click
dvPageNumbers.Controls.Add(btn)
i += 1
Loop
The event I'm trying to get to on a click is as follows:
Protected Sub btnGrdParticipantPage_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim x = 1
...
End Sub