Compilation error using IF() operator in aspx page

Asked By 10 points N/A Posted on -
qa-featured

I tried to use the IF() operator as suggested on this article I found on stackoverflow.  I knew this was what I needed exactly to finish the aspx page I’m working on, but when I did use it, and every time I tried, I just get this error:

Compiler Error Message: BC30201: Expression expected.

Can anyone tell me how to get past this?

Error:

 Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30201: Expression expected

SHARE
Answered By 590495 points N/A #100335

Compilation error using IF() operator in aspx page

qa-featured

I think you misunderstood the use of the If() operator. You just copied the operator without knowing first its proper syntax.

The wrong use or application of a command often arises when you are about to compile the program.

If there are instructions in the program flow that lack certain expressions or commands that are improperly used or you mistyped the command name then the compiler will display all the possible errors and its locations in the program.

The reason why you are getting this “expression expected” error is that the compiler is expecting a value or arguments inside the “()”. Maybe you just entered the “If()” operator without putting any argument inside the parenthesis.

The correct syntax for the If() operator is value = If(nullable, defaultValueIfNull).

Check again your coding and then put the right value inside the parenthesis.

Related Questions