Simple if then else statement

  • Thread starter Thread starter Arjen
  • Start date Start date
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!
 
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;
 
<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!
 
Back
Top