Copied to clipboard

Flag this post as spam?

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


  • Graham Carr 277 posts 389 karma points
    Dec 14, 2012 @ 12:33
    Graham Carr
    0

    Embedded Content data type

    I am using the embbeded content data type, but can't work out how to find the number of items added to the control. Basically I only want to show some markup if the number of items is greater than 0. I know it is probably really simple but just can't work out how to navigate the model to get the count. An example of what I am doing is shown below.

    @{
      //if(count of item is greater than 0)
      //{
      <div class="columnContent" style="margin-bottom:0px;padding-bottom:0px;">
        <ul id="delivers">
          @foreach (dynamic item in Model.optaDeliversTicker)
          {
              <li>
                 <h2 class="testFeed">@item.optaDeliversNumber.InnerText.ToString()</h2>
                 <p class="sportData">@item.optaDeliversText.InnerText.ToString()</p>
              </li>
          }
        </ul>  
      </div>
      //}
    }

    Any help would be great.

Please Sign in or register to post replies

Write your reply to:

Draft