Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > hyperlink variable

Reply
Thread Tools

hyperlink variable

 
 
Looch
Guest
Posts: n/a
 
      06-04-2007
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.

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      06-04-2007
On Jun 4, 10:12 pm, Looch <(E-Mail Removed)> wrote:
> 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");

 
Reply With Quote
 
 
 
 
Looch
Guest
Posts: n/a
 
      06-04-2007
On Jun 4, 4:18 pm, Alexey Smirnov <(E-Mail Removed)> wrote:
> On Jun 4, 10:12 pm, Looch <(E-Mail Removed)> wrote:
>
> > 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.

 
Reply With Quote
 
=?ISO-8859-1?Q?G=F6ran_Andersson?=
Guest
Posts: n/a
 
      06-05-2007
Looch wrote:
> On Jun 4, 4:18 pm, Alexey Smirnov <(E-Mail Removed)> wrote:
>> On Jun 4, 10:12 pm, Looch <(E-Mail Removed)> wrote:
>>
>>> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Variable variable name" or "variable lvalue" mfglinux Python 11 09-12-2007 03:08 AM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink davetichenor ASP .Net 1 10-30-2006 02:57 PM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink Dave ASP .Net Datagrid Control 0 10-21-2006 07:48 PM
How do I scope a variable if the variable name contains a variable? David Filmer Perl Misc 19 05-21-2004 03:55 PM
Dynamically Hyperlink and Event Handler for the Hyperlink ? Ken ASP .Net Datagrid Control 1 08-15-2003 11:38 PM



Advertisments