Print Page | Close Window

show discount prices if listprice is more than 0

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=21645
Printed Date: 29 March 2026 at 5:15pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: show discount prices if listprice is more than 0
Posted By: urko
Subject: show discount prices if listprice is more than 0
Date 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



Replies:
Posted By: michael
Date 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.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net