Conditional Operator in ASP

B

Brad Farrell

I'm trying to code a line in my .asp that will check for one of three values
in a field and either:

a) if null, no display

b) if set to -.01, show the "Please call..."

c) show the price

I can't see how my code below is failing, but I get an error

error CS0131: The left-hand side of an assignment must be a variable,
property or indexer

Any ideas?

Using .net 2.0 and VSE 2005



Thanks.



<%# (Double.Parse(DataBinder.Eval(Container.DataItem,
"SalePrice").ToString()) = 0) ? "" :

(Double.Parse(DataBinder.Eval(Container.DataItem, "SalePrice").ToString())
= -.01) ? "<font color=\"#ff0000\">Please call for price" :

"Special price: </b><font color=\"#ff0000\">" +
DataBinder.Eval(Container.DataItem, "SalePrice", "{0:c}")%>
 
G

Guest

Hi

Replace the "=" operator with "==" . This the actual equalto operator.

1. = -.01 should be == -.01
2. = 0) ? should == 0) ?

Hope this helps

Prem
 
B

Brad Farrell

Talk about a bone head mistake. Thanks!

B
Prem Kumar said:
Hi

Replace the "=" operator with "==" . This the actual equalto operator.

1. = -.01 should be == -.01
2. = 0) ? should == 0) ?

Hope this helps

Prem
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top