1

I would like to fetch an imagefield from the multivalue Embedded Schema Field. Here is my code.

@foreach(var banners in Fields.Banners)
{
  @if(banners.RDBannerSchema.WebBannerImage.ID !=null)
      <img src="@banners.RDBannerSchema.WebBannerImage.ID" alt="" />
      <div class="blockCont">
        <h2>@blocks.Fields.Title</h2>
        <div class="overCont">
             @blocks.Fields.Description
             <a href="javascript:;">@blocks.Fields.LinkText</a>
        </div>
      </div>
  </div>
}

When I render this page I got error Message.

System.Collections.Generic.List<Tridion.Extensions.Mediators.Razor.Models.ComponentModel>' does not contain a definition for 'ID']

In Anguilla

2

I Found the answer for this issue. Thanks http://codedweapon.com/

@foreach (var embeddedFields in Fields.SomeEmbeddedFields) {
  <div class="@(embeddedFields.IsLast ? "last" : String.Empty)">@embeddedFields.Address (@embeddedFields.ZipCode)</div>
}

http://codedweapon.com/tag/templating/

0

You can fatch the image value like this @if (Component.Fields.thumbnail != null) { @Component.Fields.thumbnail.Fields.alt }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.