hyperlink variable

L

Looch

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.
 
G

Guest

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");
 
L

Looch

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.
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Looch said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top