Reputation: 21
If I enter the following mark-up in my aspx page, it builds with no errors:
<%if(_Competition == null && IsCompetitionPage)
{%>
But!
<%else if(_Competition == null && IsCompetitionPage)
{%>
gives the following error:
CS1525: Invalid expression term 'else'
Upvotes: 0
Views: 59
Reputation: 7303
Remove any page content you've placed between the closing brace of the if
statement and the start of the else
.
For example, this will fail:
<%
if (_Competition == null && IsCompetitionPage) {
%>
<h2>Some content</h2>
<%}%>
INVALID CONTENT HERE
<%
else if (!IsCompetitionPage) {
%>
<h2>Some different content here</h2>
<%}%>
Removing 'INVALID CONTENT HERE' should fix the issue.
Upvotes: 1