By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,969 Members | 1,564 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,969 IT Pros & Developers. It's quick & easy.

hyperlink variable

P: n/a
Something simple here (hopefully)...how can I append the text in a
text box to a hyperlink? For example, I enter the string 'Printer223'.
There is an Excel file with the same name that I want to open
(Printer223.xls). Basically http://localhost/printers/whatever I put
in the textbox.xls is what I'm after. Thanks.

Jun 4 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Jun 4, 10:12 pm, Looch <lucianoj2...@yahoo.comwrote:
Something simple here (hopefully)...how can I append the text in a
text box to a hyperlink? For example, I enter the string 'Printer223'.
There is an Excel file with the same name that I want to open
(Printer223.xls). Basicallyhttp://localhost/printers/whateverI put
in the textbox.xls is what I'm after. Thanks.
How do you want to open the file? Using a postback button?

Response.Redirect("http://localhost/printers/" + TextBox1.Text +
".xls");

Jun 4 '07 #2

P: n/a
On Jun 4, 4:18 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jun 4, 10:12 pm, Looch <lucianoj2...@yahoo.comwrote:
Something simple here (hopefully)...how can I append the text in a
text box to a hyperlink? For example, I enter the string 'Printer223'.
There is an Excel file with the same name that I want to open
(Printer223.xls). Basicallyhttp://localhost/printers/whateverIput
in the textbox.xls is what I'm after. Thanks.

How do you want to open the file? Using a postback button?

Response.Redirect("http://localhost/printers/" + TextBox1.Text +
".xls");
Basically I just need to do this (using VBScript). The example below
doesn't seem to work though.

"http://amslpsvr1/consumables/OrderForms/" & strOrder &".xls"

Here's the actual code (I'm a noob but I can get any Excel file to
open this way!)

<script language ='vbscript' >
dim objExcel
dim wb
dim strOrder as string = me.txtOrderFrm.text
Sub cmdOrderFrm_onclick()
call OpenWorkbook("http://amslpsvr1/consumables/OrderForms/" &
strOrder & ".xls")
end sub
sub OpenWorkbook(strLocation)
set objExcel = CreateObject("Excel.Application")
objExcel.Visible = true
objExcel.Workbooks.Open (strLocation)
objExcel.UserControl = true
end sub
</script>

Thanks again for any help.

Jun 4 '07 #3

P: n/a
Looch wrote:
On Jun 4, 4:18 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
>On Jun 4, 10:12 pm, Looch <lucianoj2...@yahoo.comwrote:
>>Something simple here (hopefully)...how can I append the text in a
text box to a hyperlink? For example, I enter the string 'Printer223'.
There is an Excel file with the same name that I want to open
(Printer223.xls). Basicallyhttp://localhost/printers/whateverIput
in the textbox.xls is what I'm after. Thanks.
How do you want to open the file? Using a postback button?

Response.Redirect("http://localhost/printers/" + TextBox1.Text +
".xls");

Basically I just need to do this (using VBScript). The example below
doesn't seem to work though.

"http://amslpsvr1/consumables/OrderForms/" & strOrder &".xls"

Here's the actual code (I'm a noob but I can get any Excel file to
open this way!)

<script language ='vbscript' >
dim objExcel
dim wb
dim strOrder as string = me.txtOrderFrm.text
Sub cmdOrderFrm_onclick()
call OpenWorkbook("http://amslpsvr1/consumables/OrderForms/" &
strOrder & ".xls")
end sub
sub OpenWorkbook(strLocation)
set objExcel = CreateObject("Excel.Application")
objExcel.Visible = true
objExcel.Workbooks.Open (strLocation)
objExcel.UserControl = true
end sub
</script>

Thanks again for any help.
First of all, you are in the wrong newsgroup. This has nothing to do
with ASP.NET.

Anyway, depending on where you put the script, you are either getting
the value from the text box when the page is loading, or trying to get
it before the text box even exists.

If you want to get the value from the text box at the time of calling
the cmdOrderForm_onclick subroutine, you have to put the code that gets
the value inside the subroutine.

Note also that "me" gets a different meaning if you put it inside the
subroutine, as it then will refer to the control that you clicked rather
than the window object.

--
Göran Andersson
_____
http://www.guffa.com
Jun 5 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.