By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

How to create hyperlinks dynamically when a button is clicked? ASP (vb)

P: 1
Hi. i have created a textbox and a button for my page. I want to create a hyperlink everytime a button is clicked. The hyperlink will be displayed in a placeholder. however, whenever i add another hyperlink, the previously created hyperlink will just be replaced by the new hyperlink. What code should i add so that the new created hyperlink will just be added in the placeholder, not just replacing the hyperlink there? or is there another approach to do so? please help me out.

This is my code.
Expand|Select|Wrap|Line Numbers
  1. Dim link As New HyperLink()
  2.         Dim ltr As New Literal()
  3.         link.ID = 1
  4.         link.Text = TextBox1.Text
  5.         link.NavigateUrl = "Default.aspx?field1=" + TextBox1.Text + " "
  6.         ltr.Text = "<br/>"
  7.         PlaceHolder1.Controls.Add(ltr)
  8.         PlaceHolder1.Controls.Add(link)
Mar 20 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.