Show dynamic content if greater than 0

Show dynamic content if greater than 0

am 04.01.2007 10:29:09 von Simon Gare

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

Re: Show dynamic content if greater than 0

am 04.01.2007 10:40:56 von Robert Chapman

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" wrote in message
news:erqQkL%23LHHA.2456@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
>
>

Re: Show dynamic content if greater than 0

am 04.01.2007 11:02:56 von Simon Gare

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" wrote in message
news:OAblzR%23LHHA.4244@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" wrote in message
> news:erqQkL%23LHHA.2456@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
> >
> >
>
>

Re: Show dynamic content if greater than 0

am 04.01.2007 11:07:26 von exjxw.hannivoort

Mike wrote on 04 jan 2007 in microsoft.public.inetserver.asp.general:

> "Simon Gare" wrote in message
> news:erqQkL%23LHHA.2456@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
%>



....





--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: Show dynamic content if greater than 0

am 04.01.2007 11:45:03 von Daniel Crichton

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