?
Solved

ASP/javascript in ASP/VBscript

Posted on 2014-02-03
10
Medium Priority
?
616 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:Aleks
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 39830330
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 31

Expert Comment

by:Wayne Barron
ID: 39830340
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 34

Expert Comment

by:Big Monty
ID: 39830349
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 39832031
' 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:Aleks
ID: 39854814
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
 
LVL 34

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 39854823
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 34

Expert Comment

by:Big Monty
ID: 39854824
just curious, did none of the solutions already posted meet your needs?
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 39861803
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:Aleks
ID: 39862099
Sorry .. I have been out all day. I will test this tomorrow morning
0
 

Author Closing Comment

by:Aleks
ID: 39864826
Perfect, thanks !
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The viewer will learn how to count occurrences of each item in an array.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

840 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