?
Solved

ASP/javascript in ASP/VBscript

Posted on 2014-02-03
10
Medium Priority
?
608 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 33

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 53

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 33

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 33

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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
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…
Suggested Courses

762 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