472,364 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 software developers and data experts.

using a vbscript function to feed a hyperlink into a javascript grid on an ASP page

12
Hello,

I have a javascript grid on my ASP page which displays information about the history of specific units produced in our manufacturing facility. One of the results is the order number on which the unit was shipped. If the unit was not shipped, obviously there is no order number; the default value of this field on the data table is 0.

Herein lies the problem; if the order number is 0, I do not want the grid to display anything. If the order number is not 0, I want it to display the order number as a hyperlink to the order.

I have been able to do one or the other, but not both. I can display the order number as a hyperlink. OR by calling a vbscript function, I can test the order number, and if it is 0, I can omit it from the grid.

However, I have had no success in trying to get the vbscript function to spit out a hyperlink if the order number is not 0. It seems I am close, but I can't get it formatted just right for input into the javascript code for the grid.

Here is the line of code from the javascript grid:
Expand|Select|Wrap|Line Numbers
  1. Grid1.colData[8] = 'shipped(rsProduction.fields.getValue(\'Order_No\'))';
Here is the vbscript function:
Expand|Select|Wrap|Line Numbers
  1. function shipped(order_no)
  2.  if order_no=0 then
  3.  shipped=""
  4.  else
  5.  shipped=""<A HREF=Historical_Order.asp?Order_No=" + rsProduction.fields.getValue(\'Order_No\') + ">" + rsProduction.fields.getValue(\'Order_No\') +"</a>""
  6.  end if
  7. end function
Here is the error the page returns:
Expand|Select|Wrap|Line Numbers
  1. [size=2] [/size]
  2.  
  3.  
  4. Microsoft VBScript compilation [font=Arial][size=2]error '800a0401'[/size][/font][font=Times New Roman][size=3] [/size][/font]
  5.  
  6. [font=Arial][size=2]Expected end of statement[/size][/font] 
  7.  
  8. [font=Arial][size=2]/BatchReportInfotest.asp[/size][/font][font=Arial][size=2], line 528[/size][/font] shipped=""<A HREF=Historical_Order.asp?Order_No=" + rsProduction.fields.getValue(\'Order_No\') + ">" + rsProduction.fields.getValue(\'Order_No\') +"</a>""-------------^
I have tried a mix of single and double quotations, etc. to try to get the hyperlink to feed properly into the grid code, but no such luck.

Here is the original working code from the javascript grid which did not test for the result of 0:
Expand|Select|Wrap|Line Numbers
  1. Grid1.colData[8] = '"<A HREF=Historical_Order.asp?Order_No=" + rsProduction.fields.getValue(\'Order_No\') + "> " + rsProduction.fields.getValue(\'Order_No\') +"</a>"';
Help...?
Mar 10 '08 #1
2 2658
jhardman
3,406 Expert 2GB
you have too many quote marks. Try this.
Expand|Select|Wrap|Line Numbers
  1. dim q
  2. q = chr(34)
  3. function shipped(order_no)
  4.    if order_no=0 then
  5.       shipped=""
  6.    else
  7.       shipped="<A HREF=" & q & "Historical_Order.asp?Order_No="
  8.       shipped = shipped & rsProduction.fields.getValue(\'Order_No\') & q & ">"
  9.       shipped = shipped & rsProduction.fields.getValue(\'Order_No\') & "</a>"
  10.    end if
  11. end function
Let me know if it helps.

Jared
Mar 12 '08 #2
jhardman
3,406 Expert 2GB
or if you can't use quote marks,
Expand|Select|Wrap|Line Numbers
  1. q = "'"
is the next thing I would suggest
Mar 12 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Jonas Daunoravicius | last post by:
The subject pretty much sums up what I need to do. Here is what I have so far, but still can't figure out how to get it working: <script language="javascript" type="text/javascript"> function...
2
by: Frank | last post by:
When I used IE 6.0 to view the ASP page on Window 2000 server PC, I encountered the error message: "Expected end of statement". The ASP page code is as:...
29
by: Christopher Brandsdal | last post by:
If I have a .ASP page that runs JScript code - is it possible to include an ..ASP page that runs VBscript???
3
by: David Shorthouse | last post by:
Hey folks, Not an off-topic posting.....since I was shot-down in an earlier post...this one's legit. How do I go about calling a server-side vbscript within a client-side javascript function?...
4
by: gf | last post by:
<script> function testme(testvar) { if (testvar=='1') { alert('testvar=1'); document.open(); document.write('This is just some text<br /><br />"); document.write('<a...
14
by: Paul | last post by:
Hi I have 2 functions in java script, one opens a second window-this works, the other is supposed to close this second window, does not seem to be working. Just wondering if anyone had any ideas....
10
by: Shadow Lynx | last post by:
That subject packs a whallop, so let me explain in better detail what's happening and how it relates to ASPX pages... In a nutshell, if the first <script /on a page is of type "text/vbscript",...
9
by: smokeyd | last post by:
hi, can anyone tell me how to open a link in a new browser window in vbscript.net. i am looking to be able to set the properties such as size, menu bar, scroll bar etc. or alternativelly is...
3
by: jacelyn2211 | last post by:
Hi, i have a grid / table in html form as followings code,:- function addCritr(curno){ var f = document.frmC5W002; // check val 1 & val 2 range if...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.