Copied to clipboard

Flag this post as spam?

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


  • hetaurhet 245 posts 267 karma points
    Dec 14, 2012 @ 07:37
    hetaurhet
    0

    loop through nodes and store value in array

    I have razor script having following code....

    <script type="text/javascript">
    @{
    var arr = new Array[10];
    var j=0;
    
    foreach (var node in Model.Children.Where("Visible"))
    {
      arr[j]=@node.UrlName;
      j++;
    }
    }
    </script>

    But this is giving Error loading Razor Script getNodes.cshtml. I want to store values in array as,

    ['aaa-node','bbb-node','ccc-node']

    So, what is the mistake in code?

Please Sign in or register to post replies

Write your reply to:

Draft