Figer's Technology Consulting | Dynamically adding controls to a placeholder control in ASP.NET

Dynamically adding controls to a placeholder control in ASP.NET

Loop through your collection of controls (count of i) you would like to add to the ASP.NET placeholder control on your aspx page.

Dim lnkButtonSelfInitiate As LinkButton = New LinkButton()
lnkButtonSelfInitiate.Text = vCellLocalLink.InnerText
AddHandler lnkButtonSelfInitiate.Click, AddressOf btn_Click
Me.plhSelfInitiate.Controls.Add(lnkButtonSelfInitiate)

Protected Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.lblTest.Text = "test"
End Sub
Comments are closed