VBscript boolean function causes Javscript to bomb

calgarychinese's Avatar
Email Reported As Spam
Hi there

I have a server-side VB that runs at the beginning of the asp page, and it returns a result set, call it loResultSet.

In the client side javscript, I was trying to check to see if this result set is nothing or not.

if (<%=(loResultSet is nothing)%>)

{

// javscript code

}



However it bombs because that (loResultSet is nothing) returns "True", as opposed to "true", and Javascript doesn't recognize True.

I know this is a dumb question, but how would you fix this, and I mean, not in a hack way, such as

if (%=(loResultSet is nothing)%>.toString().toLowerCase())



Many thanks appreciated.

CC
0
pradeep's Avatar, Join Date: Apr 2005
Team Leader
Code: ASP
if (eval("<%=(loResultSet is nothing)%>%>".toString().toLowerCase()))

{

// javscript code

}

Try this!
0
calgarychinese's Avatar
Email Reported As Spam
Hi pradeep, however how is your solution different than mine except for the eval part you added? (I was actually hoping there would be some standard function to do that, for us to manipulate the results like this looks a little counter-productive - I guess that's the diff between javascript and vbscript...)

Thanks