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!
 

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

Back
Top