Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Some of my questions are embarassing, here's another.
How do you output ordinary text if an if condition is fulfilled?
eg
if(@blogpost.blogImage.ToString().Length > 0) { @Model.MediaById(System.Convert.ToInt32(@blogpost.blogImage)).umbracoFile //ok <p>wow</p> //fails! }
try this
@if(blogpost.blogImage.ToString() !="")
{
@Model.MediaById(System.Convert.ToInt32(@blogpost.blogImage)).umbracoFile //ok<p>wow</p> //fails!}else { <p>Sorry no content available</p>}
Hi Petras, I can't replicate your problem it works fine for me, do you get an error?
You can force the Razor View engine to switch to Markup using the @: syntax
@:<p>wow</p>
I am dsylexic, my original example actually works.
There was a bug in another statement!
Although I never knew about Alex's post.
Thank you very much for the @: syntax. I been banging my head with a problem of the markup.
When I get more carma points, I give you a helpful click
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How do you output text if an if condition is fulfilled?
Some of my questions are embarassing, here's another.
How do you output ordinary text if an if condition is fulfilled?
eg
try this
@if(blogpost.blogImage.ToString() !="")
{
@Model.MediaById(System.Convert.ToInt32(@blogpost.blogImage)).umbracoFile //ok
<p>wow</p> //fails!
}
else { <p>Sorry no content available</p>
}
Hi Petras, I can't replicate your problem it works fine for me, do you get an error?
You can force the Razor View engine to switch to Markup using the @: syntax
I am dsylexic, my original example actually works.
There was a bug in another statement!
Although I never knew about Alex's post.
Thank you very much for the @: syntax. I been banging my head with a problem of the markup.
When I get more carma points, I give you a helpful click
is working on a reply...