I am working on an ASP.NET project with VB backend, and have run into a slight problem. We generate buttons dynamically (up/down arrows to reorder the records in the dataset) - but we can't figure out how to assign an event to each dynamically generated button.
Here is how we create the buttons, and our unsuccessful attempt to add a handler...
dim i as integer
for i = 0 to 'number of rows in datatable -1
'create up/down btns
Dim btnUp As New Button
btnUp.ID = "btnUp" & i
AddHandler btnUp.Click, AddressOf btnUpClick
btnUp.Text = "UP"
Private Sub btnUpClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.errorText.Text = "trapped up click"
Thanks in advance for any help...let me know if you need any more info.