Solved

ASP/javascript in ASP/VBscript

Posted on 2014-02-03
10
538 Views
Last Modified: 2014-02-17
I have this code which works for ASP/Javascript pages

<% if (Qnrview.Fields.Item("ParamValue").Value == (1)) { // script %>
HELLO
<% } // if (Qnrview.Fields.Item("ParamValue").Value == (1)) script %>


I need to aquivalent for ASP/VB Script
0
Comment
Question by:amucinobluedot
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 30

Expert Comment

by:Wayne Barron
Comment Utility
give this a shot

<%
if Qnrview("ParamValue") = 1 then
response.write "Hello 1"
else
response.write "Hello 2"
end if
%>

Open in new window


Carrzkiss
0
 
LVL 30

Expert Comment

by:Wayne Barron
Comment Utility
Also.
Since you are just getting into ASP Classic VB
May I suggest the following Video Lesson's
http://www.youtube.com/playlist?list=PL00AD0C15B4892027


Good Luck
Carrzkiss
0
 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
if you have other values for ParamValue, I would use a select statement:

<%
dim param: param = Qnrview("ParamValue")

if param = "" or not isNumeric( param ) then
   param = -1
else
   param = CInt( param )
end if

if param > -1 then
   select case param
      case 1: Response.Write "Hello 1"
      case 2: Response.Write "Hello 2"
      default: "Default message if param doesn't equal the other values"
   end select
end if
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
Comment Utility
' trim takes out any space " 1 " becomes "1".
' Cstr converts numeric to a string.  This way you account for blanks.  
if Cstr(trim(Qnrview.Fields.Item("ParamValue").Value))="1" then
    response.write "hello, I am 1"
    else
    response.write "sorry, I am not 1"
end if

' if you want to account for the null values
if not isnull(Qnrview.Fields.Item("ParamValue").Value) then
   if Cstr(trim(Qnrview.Fields.Item("ParamValue").Value))="1" then
       response.write "hello, I am 1"
       else
       response.write "sorry, I am not 1"
   end if
end if

Open in new window

0
 

Author Comment

by:amucinobluedot
Comment Utility
Lets try once more. I have this code in Classic ASP/Javascript and need two lines in ASP/VBScript to replace this code:

<% if (Qnrview.Fields.Item("ParamValue").Value == (1)) { // script %>
HELLO
<% } // if (Qnrview.Fields.Item("ParamValue").Value == (0)) script %>
HELLO1
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 32

Accepted Solution

by:
Big Monty earned 500 total points
Comment Utility
this will do exactly as above:

<%
if Qnrview("ParamValue") = "1" then
      Response.Write "HELLO"
elseif Qnrview("ParamValue") = "0" then
      Response.Write "HELLO1"
end if
%>

or you could do:

<%if Qnrview("ParamValue") = "1" then %>
HELLO
<%elseif Qnrview("ParamValue") = "0" then%>
HELLO1
<%end if%>
0
 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
just curious, did none of the solutions already posted meet your needs?
0
 
LVL 30

Expert Comment

by:Wayne Barron
Comment Utility
The code that I posted above
http:#a39830330
Will do what you want, in VB, just as your code did in JS.
With the least amount of code lines.
0
 

Author Comment

by:amucinobluedot
Comment Utility
Sorry .. I have been out all day. I will test this tomorrow morning
0
 

Author Closing Comment

by:amucinobluedot
Comment Utility
Perfect, thanks !
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now