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>
                            }
                        }

Comments

Popular posts from this blog

Umbraco - Reset the Admin Password via SQL Server

Create a .NET Contact Form that Gets the Last Url Visited in C# Can also be Used in Umbraco

Umbraco Macro for IFrame when Embedding Video, Vimeo Universal Player, or other types of IFrame on to a Page XSLT version and Razor Version