473,387 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.
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
0 961

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

Similar topics

3
by: TJS | last post by:
trying to get 2 scripts to run when a button is clicked. The first is a confirm which should only run the second script if true. the problem is the second script doesn't run when "ok" is selected...
0
by: L Mehl | last post by:
Hello -- My form's cmdCancel button requires 3 clicks before the code in Cancel_Click fires. Each click prior to that success moves the highlight to the next field in the Tab order . I...
2
by: Patrick | last post by:
i have the following .aspx file defined: ..... other tags here ... <asp:TableCell><asp:button id="AddButton" Runat="server" Text="Add New Vessel..."</asp:button></asp:TableCell> ..... other tags...
7
by: rsaffy | last post by:
I am having trouble with my dynamically created button's event handling. I read that the buttons need to be recreated on every trip to the server, but how exactly do you do that when the datagrid...
1
by: CHNLAKSHMI | last post by:
There are two textboxes and a button. If we click the button,the text must be entered into focused textbox
3
matrekz42
by: matrekz42 | last post by:
This may seem extremely simple, but I want to have in VB a code that will change the width of a TextBox when a button in the form is clicked. How can I go about this?
5
by: Jim in Arizona | last post by:
When placing a link using html, it's easy to have a new window opened for the link instead of redirecting the current page to the destination. IE: <a href="../folder5/anotherpage.aspx"...
1
by: Claudiu | last post by:
Hi, I have the following code and no matter what I do onclick event for button is not firing. I tried deleting the button, the pages. Redid the code. Moved the web project to a different...
1
by: mcupito | last post by:
I've a Combobox in a subform that will contain values. While entering data on the subform, a value of '?????' is acceptable, however when the 'Submit' button is clicked on the main form, I wish to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.