Copied to clipboard

Flag this post as spam?

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


  • Paul reynolds 2 posts 22 karma points
    Jan 30, 2013 @ 22:55
    Paul reynolds
    0

    Preview Error

    HI,

    Every time i ry to prewiw my it using this template a keep getting 

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ Layout = "SW_Master.cshtml"; }

      @{ var nodeIds = Model.Content.GetPropertyValue("slideshow").ToString().Split(','); List slides = new List(); foreach (var nodeId in nodeIds) { if (!String.IsNullOrEmpty(nodeId)) { var publishedContent = Umbraco.NiceUrl(Convert.ToInt32(nodeId)); if (!String.IsNullOrEmpty(publishedContent) && publishedContent != "#") { slides.Add(Umbraco.TypedContent(nodeId)); } } } } @foreach (var slide in slides) { if(slide != null) { string styleString = !slide.IsFirst() ? "display:none;" : "";
    • @slide.Name
      @Html.Raw(@slide.GetPropertyValue("bodyText").ToString())
    • } }
      @foreach (var slide in slides) { string classString = slide.IsFirst() ? "selected" : "";
    • @slide.Position()
    • }
    @Html.Raw(Model.Content.GetPropertyValue("panelContent1").ToString())
    @Html.Raw(Model.Content.GetPropertyValue("panelContent2").ToString())
    @Html.Raw(Model.Content.GetPropertyValue("panelContent3").ToString())
    I have try to reinstall it but ran into the same problem.I have change the defaultRenderingEngine to Mvc alady but it still will not work!... any ideas how i can fix it?
    Paul

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 31, 2013 @ 22:03
    Jan Skovgaard
    1

    Hi Paul

    What version of Umbraco are you seeing this on?

    /Jan

  • Chris Koiak 700 posts 2626 karma points
    Feb 17, 2013 @ 11:10
    Chris Koiak
    0

    HI Paul,

    I think you've forgotten to set the defaultRenderingEngine to Mvc

  • Ibrahim Uslu 3 posts 25 karma points
    Mar 11, 2013 @ 14:02
    Ibrahim Uslu
    0

    Hi,

    I have the same problem. Does anyone solved the issue. - defaultRenderingEngine to Mvc is already set ;-) 

    cheers!

  • Damian Green 452 posts 1433 karma points
    Apr 09, 2013 @ 10:20
    Damian Green
    0

    I think its a coding issue thats stopping the view compiling.

    I've just bashed it into a view and it wasnt compiling for me.

    Made a couple of changes and it now compiles.

    First thing was moving the @{ inheritis off the first line and then also making the list a generic list.

    Paste this in and see if it fixes it.

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage 
    @{ 
        Layout = "SW_Master.cshtml"; 
    }
    
    @{ 
        var nodeIds = Model.Content.GetPropertyValue("slideshow").ToString().Split(','); 
        List<IPublishedContent> slides = new List<IPublishedContent>(); 
        foreach (var nodeId in nodeIds) 
        { 
            if (!String.IsNullOrEmpty(nodeId)) 
            { 
                var publishedContent = Umbraco.NiceUrl(Convert.ToInt32(nodeId)); 
    
                if (!String.IsNullOrEmpty(publishedContent) && publishedContent != "#") 
                { 
                    slides.Add(Umbraco.TypedContent(nodeId)); 
                } 
            } 
        } 
    } 
    
    @foreach (var slide in slides) 
    { 
        if(slide != null) 
        { 
            string styleString = !slide.IsFirst() ? "display:none;" : "";
    
            @Html.Raw(@slide.GetPropertyValue("bodyText").ToString())
        } 
    }
    
    @foreach (var slide in slides) { 
        string classString = slide.IsFirst() ? "selected" : "";
        @slide.Position()
    }
    
    @Html.Raw(Model.Content.GetPropertyValue("panelContent1").ToString())
    @Html.Raw(Model.Content.GetPropertyValue("panelContent2").ToString())
    @Html.Raw(Model.Content.GetPropertyValue("panelContent3").ToString())
    
    Also not sure whats happening with his code block:
    @foreach (var slide in slides) { 
        string classString = slide.IsFirst() ? "selected" : "";
        @slide.Position()
    }

    It may not like that as its a line of code just on its own. I've had to put things like that in a html span or use the @: notation to show you are rendering out.

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies