Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP/javascript in ASP/VBscript

Posted on 2014-02-03
10
Medium Priority
?
614 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

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

Author Closing Comment

by:amucinobluedot
ID: 39864826
Perfect, thanks !
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

636 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