BioloMICS logo
×
BioloMICS Web Menu

O field in razor (Ontology)

 
 
The Ontology field in the razor is treated like a link field, therefore @foreach need to be used.
 
 
 
 
        <tr>
            <td>@Model.O472.Label</td>
            <td>
                @foreach(var ontology in @Model.O472) {
                <span><p> @ontology.Name</p</span>
                }
            </td>
        </tr>
 
 
Extra explanation on the code:
 
  • @foreach is needed to make sure that all levels are displayed.
     
  • ontology own chosen name for this variable.
     
  • @ontology.Name the record name of the higher level.
     
 
 
The code placed in a table:
 
<table class="table">
    <thead>
    </thead>
    <tbody>
        <tr>
            <td>@Model.O472.Label</td>
            <td>
                @foreach(var ontology in @Model.O472) {
                <span><p> @ontology.Name</p</span>
                }
            </td>
        </tr>
    </tbody>
</table>