Copied to clipboard

Flag this post as spam?

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


  • malar 97 posts 206 karma points
    May 14, 2018 @ 13:15
    malar
    0

    Hi

    I have written this code. it is displaying error. Can you please help me.

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using System.Globalization;
    
    @{ int number1 = Convert.ToInt32(@Parameter.rowNum1); 
        int number2 = Convert.ToInt32(@Parameter.rowNum2);
    
        var top3News = Model.Content.Descendants().Where(x => x.DocumentTypeAlias == "Arrangement" || x.DocumentTypeAlias == "nyhed" && orderDate != "Null");
        string caption = "";
    
        int chars = 0;
        int counter = 0;
        var cnt = 0;
    
    }
    
        @foreach(var newsNode in top3News) {
            if (newsNode.Content.HasValue("orderDate")) {
                if(newsNode.IsNull("startTime")) {
                    cnt += 1;
                }
                sortedNodes.Add(newsNode);                  
            }
        }
        sortedNodes = sortedNodes.OrderBy("orderDate desc").Skip(number1).Take(number2);
    
    
        <div class="newsWidthRow">  
            <div class="newsRow row">
    
                @foreach (var page in sortedNodes)  {
                    counter += 1;
    
                    if (page.Content.HasValue("startTime")) {
                        var startTime = @page.startTime;
                        var endTime = @page.endTime;
    
                        if (startTime.Day == endTime.Day) {                     
                            caption = page.GetPropertyValue<DateTime>("startTime").ToString("d. MMMM", CultureInfo.CreateSpecificCulture("da-DK"));
                            caption += " - " + page.GetPropertyValue<DateTime>("endTime").ToString("H:mm", CultureInfo.CreateSpecificCulture("da-DK"));                 
                        } else {
                            caption = page.GetPropertyValue<DateTime>("startTime").ToString("d. MMMM", CultureInfo.CreateSpecificCulture("da-DK")); 
                            caption += " - " + page.GetPropertyValue<DateTime>("endTime").ToString("d. MMMM", CultureInfo.CreateSpecificCulture("da-DK"));
                        }
                    } else {
                        caption = "";
                    }
    
                    if (top3News.Last().Id == page.Id) {
                        <div class="newsColumn col-xs-6 col-sm-6 col-md-6 col-lg-4" style="border-bottom: none;margin-bottom:0;padding-bottom:0;">  
                            } else {
                    <div class="newsColumn col-xs-6 col-sm-6 col-md-6 col-lg-4">        
                            }
                    <div class="newsInner">
                        <a href="@page.Url">
    
                            <div class="newsTitle">
                                <p style="font-weight: bold;letter-spacing: 0.4px;font-size: 11px;color: grey;">@page.orderDate.ToString("dd.MM.yyyy")</p>
                                <h1>@page.GetPropertyValue("title")</h1>
                                <h2 style="font-weight: bold;font-size: 15px;margin-top: 8px;margin-bottom: 8px;color: black;">@page.GetPropertyValue("subtitle")</h2>
                            </div>
                        </a>
    
                        <div style="clear: both;"></div>
                        <div style="margin-top: 9px;">
                            <a class="dont_underline" href="@page.Url">
                                <div class="newsTeaser">
                                    <p>@page.GetPropertyValue("teaser")</p>
                                </div>
                            </a>
                        </div>
                        <br/>
                    </div>
                </div>
                caption = "";
            }
        </div>     
    </div>      
    

    see error output: enter image description here

  • kows 81 posts 151 karma points c-trib
    May 15, 2018 @ 06:08
    kows
    0
    var top3News = Model.Content.Descendants().Where(x => x.DocumentTypeAlias == "Arrangement" || x.DocumentTypeAlias == "nyhed" && orderDate != "Null");
    

    where is orderDate declared?

            sortedNodes.Add(newsNode);                  
    

    same for sortedNodes

    I'm guessing you are mainly using dynamics?

Please Sign in or register to post replies

Write your reply to:

Draft