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
- Grid1.colData[8] = 'shipped(rsProduction.fields.getValue(\'Order_No\'))';
Expand|Select|Wrap|Line Numbers
- function shipped(order_no)
- if order_no=0 then
- shipped=""
- else
- shipped=""<A HREF=Historical_Order.asp?Order_No=" + rsProduction.fields.getValue(\'Order_No\') + ">" + rsProduction.fields.getValue(\'Order_No\') +"</a>""
- end if
- end function
Expand|Select|Wrap|Line Numbers
- [size=2] [/size]
- Microsoft VBScript compilation [font=Arial][size=2]error '800a0401'[/size][/font][font=Times New Roman][size=3] [/size][/font]
- [font=Arial][size=2]Expected end of statement[/size][/font]
- [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>""-------------^
Here is the original working code from the javascript grid which did not test for the result of 0:
Expand|Select|Wrap|Line Numbers
- Grid1.colData[8] = '"<A HREF=Historical_Order.asp?Order_No=" + rsProduction.fields.getValue(\'Order_No\') + "> " + rsProduction.fields.getValue(\'Order_No\') +"</a>"';