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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Smashedpotato
    New Member
    • Mar 2014
    • 1

    #1

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

    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.
    Code:
    Dim link As New HyperLink()
            Dim ltr As New Literal()
            link.ID = 1
            link.Text = TextBox1.Text
            link.NavigateUrl = "Default.aspx?field1=" + TextBox1.Text + " "
            ltr.Text = "<br/>"
            PlaceHolder1.Controls.Add(ltr)
            PlaceHolder1.Controls.Add(link)
Working...