Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon 48 posts 108 karma points
    Sep 07, 2017 @ 00:51
    Simon
    0

    Media/content output issues

    Using version 7.6.5 I've run into an issue where sometimes content doesn't render out on the page at all (and sometimes returns null). This has only come up after a recent upgrade from 7.1. Below is an example of a media type that has image, textbox and richtext properties. I've inserted comments on what's working and what's not... and what's wonky.

    @foreach (var bannerItem in Model.Content.HomepageBanner.OfType<HomepageBannerContent>()) {
        foreach (var prop in bannerItem.Properties) {
            // show me all the properties so i know i'm sane
            Print.ToPage(prop.PropertyTypeAlias);
        }
        <div class="slide">
            <div class="slide-text">
                <h2>
                    @* textbox content shows perfectly *@
                    @bannerItem.ContentTitle
                </h2>
    
                @* richtext content doesn't show *@
                @bannerItem.ContentText
    
                @* richtext outputs raw tostring converting html tags to html entities. i.e. literally <p>i am text</p> *@
                @bannerItem.GetPropertyValue("contentText")
            </div>
            <div class="slide-image">
                @* works perfectly *@
                <img src="@bannerItem.BackgroundImage.Url" />
            </div>
        </div>
    }
    

    I've been using umbraco for a while now (2 years at least, I forget :) but I can't recall having this many issues since I first started. I can't isolate if it's because of the upgrade (i.e. data not coming up correctly) or I'm just having a series of brain farts. Any help would be appreciated.

    Also, if it helps, I am using visual studio 2017, did the upgrade through nuget (with a temporary upgrade to 7.3 from 7.1 to 7.6.5) and have the following setting in my web.config so I can get at my models whilst programming:

    <add key="Umbraco.ModelsBuilder.Enable" value="true" />
    <add key="Umbraco.ModelsBuilder.EnableApi" value="true" />
    <add key="Umbraco.ModelsBuilder.EnableDllModels" value="true" />
    <add key="Umbraco.ModelsBuilder.ModelsMode" value="LiveDll" />
    
  • Simon Dingley 1474 posts 3431 karma points c-trib
    Sep 07, 2017 @ 08:51
    Simon Dingley
    1

    What are your log files saying?

    In Umbraco 7.6.x there were some breaking changes so look into those, maybe check the EnablePropertyValueConverters value in the umbracoSettings.config file is not causing you a problem.

    Simon

  • Simon 48 posts 108 karma points
    Sep 07, 2017 @ 16:09
    Simon
    0

    Oh, also... log files look normal as far as I can tell. No errors.

  • Simon 48 posts 108 karma points
    Sep 07, 2017 @ 16:08
    Simon
    0

    This was very helpful and gave me some ideas of what to look into but unfortunately, the problem persists. My currrent plan is to use the following as less than ideal workaround:

    @Html.Raw(bannerItem.GetPropertyValue("contentText"))
    

    Even more odd, is how the code below is outputting... I would expect a GetPropertyValue

    Any other ideas of what to check to make sure everything works as intended (using bannerItem.ContentText)?

    Code example:

    @{
        var contentText1 = bannerItem.GetPropertyValue("contentText");
        var contentText2 = bannerItem.GetPropertyValue<HtmlString>("contentText");
    }
    contentText1:<br>
    @contentText1
    <br>---<br>
    contentText2:<br>
    @contentText2
    

    Output:

    contentText1:
    <p>this is text</p> 
    ---
    contentText2:
    
  • Simon 48 posts 108 karma points
    Sep 12, 2017 @ 20:24
    Simon
    0

    Any new thoughts?

  • Avatar 15 posts 92 karma points
    Sep 12, 2017 @ 20:45
    Avatar
    0

    I hate to point out the obvious, but have you tried to make a change to the doctypes so that your Models DLL get regenerated?

    Also, in 7.6 there are new propery converters for .GetPropertyValue(). I read somewhere that those propery converters are only available on new installations and not upgrades. See this change.

  • Simon 48 posts 108 karma points
    Sep 12, 2017 @ 20:49
    Simon
    0

    In dev, I use LiveDLL mode to get at the models in visual studio... but this is using the content service so that doesn't help anyway because it accesses the nodes in a different, potentially unpublished, way.

    As far as the new property converters, maybe I can flip this back and forth a bit and experimentate.... just wondering if anyone else has already figured this out.

Please Sign in or register to post replies

Write your reply to:

Draft