Copied to clipboard

Flag this post as spam?

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


  • Davide Oliva 35 posts 199 karma points
    Dec 06, 2012 @ 16:12
    Davide Oliva
    0

    Razor scripts fails after upgrade to version 4.8.1

    Hi all, dear fellow members of this great community.

    We're experimenting, in a testing environment, the upgrade path from 4.7.2 to 4.11.1 for our production website, so yesterday I did the first step, bringing the test site to version 4.8.1

    Now some of my razor scripts aren't working anymore and I think that this behaviour is due to uComponents, as indicated in the documentation on codeplex. By the way, uComponents is been updated to version 5.2.

    The error is reported below

    Error Loading Razor Script (file: SidebarFigli)
    'uComponents.DataTypes.MultiUrlPicker.Dto.MultiUrlPickerState' does not contain
    a definition for 'Count()' at CallSite.Target(Closure, CallSite, Object) at ASP._Page_Macroscript_elencoAllegatidaID_cshtml in c:\inetpub\test_v411\macroscripts\elencoAllegatidaID.cshtml:line 13

    and, I suppose, this is the code that fails

    @{

        //Prende come default la pagina corrente se nodeId non passato
        var nodeId = Model.Id;
         if (Convert.ToInt32(@PageData[0]) != 0) {
          nodeId = Convert.ToInt32(@PageData[0]);
        }

        //Recupera il nodo principale da cui partire per cercare gli allegati
        var node = Model.NodeById(nodeId);

        //Cicla sugli allegati (se presenti)
        if ((node.allegati).Count() != 0)
          {
          foreach (var item in node.allegati.urlpicker)
            {
            @* Se gli allegati sono di tipo modulo o regolamento, recupera url in maniera differente *@
            if (item.mode == "Content"){
              var tipo = Model.NodeById(Convert.ToInt32(item.nodeid)).NodeTypeAlias;
              if (tipo == "modulo" || tipo == "regolamento"){
                var url = Model.NodeById(Convert.ToInt32(item.nodeid)).file.mediaItem.File.umbracoFile;
                <p><a href="@url">@item.linktitle</a></p>
              } else if (tipo == "linkEsterno") {
                var url = Model.NodeById(Convert.ToInt32(item.nodeid)).url;
                <p><a href="@url">@item.linktitle</a></p>
              } else {
                var url = umbraco.library.NiceUrl(Convert.ToInt32(item.nodeid));
                <p><a href="@url">@item.linktitle</a></p>
              }
            } else {
              <p><a href="@item.url">@item.linktitle</a></p>
            }
          }
        }
    }

     

    Unfortunately, I'm not so good in Razor to identify correctly the cause of failure.
    Someone of you could help me?

    Thanks in advance, as usual

Please Sign in or register to post replies

Write your reply to:

Draft