BioloMICS logo
×
BioloMICS Web Menu

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.
 
 
 
         <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>