Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - show discount prices if listprice is more than 0
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

show discount prices if listprice is more than 0

 Post Reply Post Reply
Author
urko View Drop Down
Groupie
Groupie
Avatar

Joined: 23 September 2004
Location: Slovenia
Status: Offline
Points: 160
Post Options Post Options   Thanks (0) Thanks(0)   Quote urko Quote  Post ReplyReply Direct Link To This Post Topic: show discount prices if listprice is more than 0
    Posted: 18 October 2006 at 9:29am
Ok, not sure how i should explain this but i need some help.

I have made a script to show items with prices.
I have following cells:
ListPrice
OurPrice

What i would like is to do is following.
If i add under Listprice lets say 50,00 and OurPrice is 25,00
I would like that users would see following:
Price: 50,00
Our Price: 25,00
You save: 25,00 (50%)


But if i have ListPrice 0,00 and OurPrice 50,00
I would like that users would see following:
Our Price: 25,00

I did the  discount and works fine, all i need is to show all prices with discount if list price is not 0,00 or other way around.

I use dataList.

My code:

List Price: €
<asp:Label ID="RednaCenaLabel" runat="server" Text='<%# Eval("ListPrice", "{0:N}") %>' Font-Strikeout="True"></asp:Label><br />

<font color="#c00000"><b>Our Price:</b> €
<asp:Label ID="NasaCenaLabel" runat="server" Text='<%# Eval("OurPrice", "{0:N}") %>' Font-Bold="True" ForeColor="#C00000"></asp:Label><br />

Discount:
€ <%#FormatNumber(Eval("ListPrice", "{0:N}") - Eval("OurPrice", "{0:N}"))%>

(<%#FormatNumber(((Eval("ListPrice") - Eval("OurPrice")) / Eval("ListPrice") * 100))%>%)


I started the code like that but i dont get the result i wanted:
Dim Myprices As Integer
Myprices = Request.QueryString("ListPrice")

If Myprices = "0,00" Then....

but it's not working Confused


Thanks.



Urko
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 20 October 2006 at 3:22pm
Not sure if I understnad you right but you want to show your price for list price if list price is 0?
If that is the case set the list price to NULL in SQL as opposed to 0 and use
Select field1,field2,IsNull(listprice,ourprise) as listprice, ourprice from table.
That way you don't have to dick around with the datalist.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.