I'm currently learning 2sxc and am building a directory app as my initial project.
I'm trying to use the following code in a list view to change the way an item is displayed based on the Boolean "UpgradedListing"
@foreach(var listing in AsList(Data)) {
<div @Edit.TagToolbar(listing)>
if(listing.UpgradedListing == 'true'){
<strong>@listing.ListingName</strong<br/>
<a href='mailto:@listing.Email'>@listing.Email</a>
<hr/>
} else {
@listing.ListingName<br/>
<a href='mailto:@listing.Email'>@listing.Email</a>
<hr/>
}
</div>
}
the resulting output looks like this:
if(listing.UpgradedListing == 'true'){ Techmedics Ltd office@techmedics.co.nz
} else { Techmedics Ltd
office@techmedics.co.nz
}
if(listing.UpgradedListing == 'true'){ Solutions Online NZ Ltd enquiries@solutions-online.co.nz
} else { Solutions Online NZ Ltd
enquiries@solutions-online.co.nz
}
in other words the if else isn't being seen as code.
Can any one explain why this is?