[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


dynamic hyperlink using text entry box and button

Posted on 2007-10-01
Medium Priority
Last Modified: 2013-11-26
Development envoirnment: asp.net 2.x, Visual Studio Pro using Web Developer.  IIS6 / Wins 2003 server.

Hi there,

I am trying to create a dynamic hyperlink -- i.e. you can type the hyperlink via the textbox entry field, then click the button to activate the link.

I have got as far as below -- but not quite there yet...

asp:TextBox ID="TextBox_EnterHyperlink" runat="server" Font-Names="Verdana" Font-Size="Small"></asp:TextBox>
            <input type="button" value="Jump to Link" onClick="self.location.href='TextBox_EnterNumber.Text';
" style="font-family: Verdana"><br />

Thank you in advance for your time and efforts with this enquiry.
Question by:amillyard
  • 2
LVL 26

Expert Comment

ID: 19994557
change the input click event to ..

 <input type="button" value="Jump to Link" onClick="self.location.href=document.location.href=document.getElementById('TextBox_EnterHyperlink').value;" style="font-family: Verdana">
LVL 26

Accepted Solution

Rejojohny earned 2000 total points
ID: 19994564
sorry .. it is
<input type="button" value="Jump to Link" onClick="self.location.href=document.getElementById('TextBox_EnterHyperlink').value;" style="font-family: Verdana">


Expert Comment

ID: 19994582
You could do this a couple different ways... it appears you want to do it in JavaScript.  If so, I suppose I'd do something like this:

<asp:TextBox runat="server" ID="TextBox1" />
<input type="button" value="Jump to Link" onclick="window.location=<%=this.TextBox1.ClientID%>.value" />

You could also do it on the server side:

<asp:TextBox runat="server" ID="TextBox1" />
<asp:Button runat="server" ID="Button1" Text="Jump to Link" OnClick="Button1_Click" />

then in your codebehind put this:

protected void Button1_Click(object sender, EventArgs e)

Author Comment

ID: 19994594
spot on !

thank you :-)

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month19 days, 13 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question