Member_2_5230414
asked on
how to set button click if id is set dynamicly
Hello,
I have set a list of link buttons dynamically (shown below)
how could i set the onlcick method so its basiclylike the below
I have set a list of link buttons dynamically (shown below)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dtholidays As New DataTable()
dtholidays = dateallreadybooked.getusers()
Dim myhols As DataView
myhols = New DataView(dtholidays, "", "", DataViewRowState.CurrentRows)
For Each Dayitis In myhols
Dim linkbutton As New LinkButton
linkbutton.Text = Dayitis.Item("FirstName") & " " & Dayitis.Item("Surename")
linkbutton.ID = Dayitis.Item("Surename")
Dim newline As String = Environment.NewLine
holder.Controls.Add(linkbutton)
Dim spacer As New System.Web.UI.WebControls.Label
spacer.Text = "<br />"
holder.Controls.Add(spacer)
Next
End Sub
how could i set the onlcick method so its basiclylike the below
Protected Sub Dayitis.Item("FirstName")_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Dayitis.Item("FirstName").Click
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.