472,356 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,356 software developers and data experts.

Show dynamic content if greater than 0

Hi all,

I have a dynamic value from a recordset that if it is a 0 value I want it to
be hidden.

something like

If Recordset.Fields.Item("CarPark") = 0 Then

value hidden

Else

Show value
Anyone help?

Regards

--
Simon Gare
The Gare Group Limited

website: www.privatehiresolutions.co.uk
Jan 4 '07 #1
4 2270
I assume by "hidden" you mean you don't want to do anything with it. In
that case, only do something if it's greater than 0.

If Recordset.Fields.Item("CarPark") >0 Then Response.Write ....

--
Mike Brind
"Simon Gare" <sg@simongare.comwrote in message
news:er****************@TK2MSFTNGP06.phx.gbl...
Hi all,

I have a dynamic value from a recordset that if it is a 0 value I want it
to
be hidden.

something like

If Recordset.Fields.Item("CarPark") = 0 Then

value hidden

Else

Show value
Anyone help?

Regards

--
Simon Gare
The Gare Group Limited

website: www.privatehiresolutions.co.uk


Jan 4 '07 #2
Thanks Mike,

having slight problem tried to replace the current

<%= FormatNumber((Pricing.Fields.Item("CarParkToDriver ").Value),
2, -2, -2, -2) %>

With

<%= If FormatNumber((Pricing.Fields.Item("CarParkToDriver ").Value),
2, -2, -2, -2) >0 Then Response.Write %>

Error message reads
Microsoft VBScript compilation error '800a03ea'

Syntax error

/online/internal/administrator/DriverPricing/2resultsDriver.asp, line 247

Response.Write(If
FormatNumber((Pricing.Fields.Item("CarParkToDriver ").Value), 2, -2, -2, -2)
>0 Then Response.Write)
---------------^

Unless i'm putting it in the wrong place?

Regards
Simon
"Mike" <in*****@invalid.comwrote in message
news:OA****************@TK2MSFTNGP04.phx.gbl...
I assume by "hidden" you mean you don't want to do anything with it. In
that case, only do something if it's greater than 0.

If Recordset.Fields.Item("CarPark") >0 Then Response.Write ....

--
Mike Brind
"Simon Gare" <sg@simongare.comwrote in message
news:er****************@TK2MSFTNGP06.phx.gbl...
Hi all,

I have a dynamic value from a recordset that if it is a 0 value I want
it
to
be hidden.

something like

If Recordset.Fields.Item("CarPark") = 0 Then

value hidden

Else

Show value
Anyone help?

Regards

--
Simon Gare
The Gare Group Limited

website: www.privatehiresolutions.co.uk


Jan 4 '07 #3
Mike wrote on 04 jan 2007 in microsoft.public.inetserver.asp.general:
"Simon Gare" <sg@simongare.comwrote in message
news:er****************@TK2MSFTNGP06.phx.gbl...
>Hi all,

I have a dynamic value from a recordset that if it is a 0 value I
want it to
be hidden.

something like

If Recordset.Fields.Item("CarPark") = 0 Then

value hidden

Else

Show value
I assume by "hidden" you mean you don't want to do anything with it.
In that case, only do something if it's greater than 0.

If Recordset.Fields.Item("CarPark") >0 Then Response.Write ....
Or you could invoke CSS
if you want to be able to show it on a clientside event:

<%
If Recordset.Fields.Item("CarPark") = 0 Then
cpark ="none"
Else
cpark = "block"
End If
%>

<style>
..cpark { display:<% =cpark %>; }
</style>

<div class='cpark' id='cpark'>....</div>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 4 '07 #4
Simon wrote on Thu, 4 Jan 2007 10:02:56 -0000:
Thanks Mike,

having slight problem tried to replace the current

<%= FormatNumber((Pricing.Fields.Item("CarParkToDriver ").Value),
2, -2, -2, -2) %>

With

<%= If FormatNumber((Pricing.Fields.Item("CarParkToDriver ").Value),
2, -2, -2, -2) >0 Then Response.Write %>

Error message reads

Microsoft VBScript compilation error '800a03ea'

Syntax error

/online/internal/administrator/DriverPricing/2resultsDriver.asp, line 247

Response.Write(If
FormatNumber((Pricing.Fields.Item("CarParkToDriver ").Value), 2, -2, -2,
-2)
>0 Then Response.Write)
---------------^

Unless i'm putting it in the wrong place?
Don't use Response.Write when you're then closing the ASP tag and showing
HTML. Either do this:

<% If FormatNumber((Pricing.Fields.Item("CarParkToDriver ").Value),
2, -2, -2, -2) >0 Then Response.Write "something" %>

or use inline HTML like this:

<% If FormatNumber((Pricing.Fields.Item("CarParkToDriver ").Value),
2, -2, -2, -2) >0 Then %>
"something"
<% End If %>

Also notice that you don't use an = at the start of the ASP code when using
a If statement, = is a shorthand replacement for Response.Write.

Dan
Jan 4 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Michael Skind | last post by:
Hello, I use a simple Table : <TABLE> <TR 1> <TD></TD> </TR> <TR 2> <TD></TD> </TR>
5
by: pizzy | last post by:
I am having a problem with the last results. I can't seem to be able to get the input2A and input3A to appear. I don't seem to have a problem with the show and hide after a number is entered and...
7
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We...
4
by: kj | last post by:
I have a dynamically generated HTML document that includes a table of numbers. In this table, I want every number greater than some numerical parameter MAX_VAL (also dynamically generated) to be...
28
by: hlubenow | last post by:
Hello, I really like Perl and Python for their flexible lists like @a (Perl) and a (Python), where you can easily store lots of strings or even a whole text-file. Now I'm not a...
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
2
by: cshaw | last post by:
Hello Everyone, I am having problems with a listbox control. I have a page with a couple of labels and drop-down lists at the top, and then below there is a table with two columns, the first column...
19
by: Rabel | last post by:
I have a page that is using tables (please no comments about this - I understand it should be css but firefox created this template) I have a menu down the left side and the bottom is supposed to...
17
by: may bailey | last post by:
Hi all, I have been trying to use a show / hide script on my web site but when I click on the "hide" button there occurs an error with explorer 7. The web site starts to go down =) and there...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.