Umbraco 7 Check to see if a filed HasVale and check to see if a Field IsNullOr Empty
The snippet below
1) Checks to see if the umbraco Field "sectionVideo" is Null or Empty.
2) Check to see if umbraco field "sectonImage" has a vale
@if(String.IsNullOrEmpty(childPage.sectionVideo) && childPage.HasValue("sectionImage"))
{
<div class="col-lg-6">
<img src="@childPage.GetCropUrl("sectionImage","rectangle")" />
</div>
}
else
{
if(childPage.HasValue("sectionVideo"))
{
<div class="col-lg-6">
<div class="product-video"><a class="swipebox-video " rel="vimeo" href="https://vimeo.com/123186702"><img class="img-responsive" src="/images/Asset%202@3x.png" alt="jsddjs"><i class="glyphicon glyphicon-play"></i></a></div>
</div>
}
}
1) Checks to see if the umbraco Field "sectionVideo" is Null or Empty.
2) Check to see if umbraco field "sectonImage" has a vale
@if(String.IsNullOrEmpty(childPage.sectionVideo) && childPage.HasValue("sectionImage"))
{
<div class="col-lg-6">
<img src="@childPage.GetCropUrl("sectionImage","rectangle")" />
</div>
}
else
{
if(childPage.HasValue("sectionVideo"))
{
<div class="col-lg-6">
<div class="product-video"><a class="swipebox-video " rel="vimeo" href="https://vimeo.com/123186702"><img class="img-responsive" src="/images/Asset%202@3x.png" alt="jsddjs"><i class="glyphicon glyphicon-play"></i></a></div>
</div>
}
}
Comments
Post a Comment