amillyard
asked on
dynamic hyperlink using text entry box and button
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:Te xtBox>
<input type="button" value="Jump to Link" onClick="self.location.hre f='TextBox _EnterNumb er.Text';
" style="font-family: Verdana"><br />
Thank you in advance for your time and efforts with this enquiry.
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
<input type="button" value="Jump to Link" onClick="self.location.hre
" style="font-family: Verdana"><br />
Thank you in advance for your time and efforts with this enquiry.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.Tex tBox1.Clie ntID%>.val ue" />
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)
{
this.Response.Redirect(thi s.TextBox1 .Text);
}
<asp:TextBox runat="server" ID="TextBox1" />
<input type="button" value="Jump to Link" onclick="window.location=<
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)
{
this.Response.Redirect(thi
}
ASKER
spot on !
thank you :-)
thank you :-)
<input type="button" value="Jump to Link" onClick="self.location.hre