Link fields in razor
Link fields in the razor are slightly different from the non-link fields.
A @foreach is needed to make sure all the linked records are taken.
These instructions are the same for the general link field (R field) as well as for the specific link fields, like Nlink, Olink etc.
-
for instructions on how to show the linked data (plus extra fields in the target table) in a table format, see Show linked records, plus extra fields, in a table format.
-
for instructions on how to make the link value clickable, see Link to see more details about target record.
<tr>
<td>@Model.Rlink257.Label</td>
<td>
@foreach(var growthmedia in @Model.Rlink257) {
<p>@growthmedia.Name</p>
}
</td>
</tr>
Extra expanation on the code:
-
@foreach is needed to make sure that all attached links are displayed.
-
growthmedia own chosen name for this variable.
-
@growthmedia.Name the record name of the record in the target table.
The code placed in a table:
<table class="table">
<thead>
</thead>
<tbody>
<tr>
<td>@Model.Rlink257.Label</td>
<td>
@foreach(var growthmedia in @Model.Rlink257) {
<p>@growthmedia.Name</p>
}
</td>
</tr>
</tbody>
</table>