Linda,
You have to add an event handler to the control that you added
dynamically. For the below example code I created a new ASP.NET
project and placed a PlaceHolder control on the form.
In the Page_Load event place the following code:
'Instance a link button
Dim MyLinkButton As New LinkButton
'Set the text
MyLinkButton.Text = "Click Here for Google"
'Dynamically add to Place Holder
PlaceHolder1.Controls.Add(MyLinkButton)
'Add an event handler to button
AddHandler MyLinkButton.Click, AddressOf HandleMyLinkButtonClick
Then create a sub (delagate) to handle the click. It must have the
parameters as in the example. This example redirects to Google.
Sub HandleMyLinkButtonClick(ByVal sender As Object, ByVal e As
System.EventArgs)
Response.Redirect("
http://www.google.com")
End Sub
If you have multiple links pointing to the same Handler you could use
something like the following to determine which link was clicked:
SelectedItemText = CType(sender, LinkButton).Text
Hope that helps.