473,322 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 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 2305
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.