I have the following syntax in a template using Razor Mediator:
<tcdl:ComponentField name="Fields.contact_nav">
@foreach (dynamic link in Fields.contact_nav.links) {
@if(link.IsFirst){...}
}
</tcdl:ComponentField>
How do I write the link.IsFirst
in MVC Razor? I have done the following:
@Html.SiteEditField(Model.Component,Model.Component.Fields["contact_nav"])
@foreach (var link in Model.Component.Fields["contact_nav"].LinkedComponentValues) {
if(link.EmbeddedValues.First()){...}
}
But it is giving error for EmbeddedValues
.
What am I doing wrong? How do I check whether a field is the first in a list or not in MVC Razor?