dynamic hyperlink using text entry box and button

Posted on 2007-10-01
Last Modified: 2013-11-26
Development envoirnment: 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
    LVL 26

    Expert Comment

    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

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

    LVL 9

    Expert Comment

    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

    spot on !

    thank you :-)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video discusses moving either the default database or any database to a new volume.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now