Simple if then else statement

A

Arjen

Hello,

I know there is a way to do a simple if then else statement in the aspx
page.
Is was something with the ?-sign.

Can somebody tell me how the syntax was?

Thanks!
 
B

Bryant Hankins

In VB.NET you use the IIF command. In C# you use ?:

Here are examples of both:

VB.NET:
IIf(TestMe > 1000, "Large", "Small")

C#:
return x != 0.0 ? Math.Sin(x)/x : 1.0;
 
S

Shiva

<var> = <conditional expr>?<true part>:<false part>;
Eg:
stsText = (status > 5)?"Moderate":"Poor";

Hello,

I know there is a way to do a simple if then else statement in the aspx
page.
Is was something with the ?-sign.

Can somebody tell me how the syntax was?

Thanks!
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top