Razor HTML examples
To 'call' a given field in the main table, use the following format:
@Model.FIELDCODESQL
As an example, in the main table, we have a D field called Temperature for growth (°C) with the SQL name "D216"
-
To get the name of the field, use: @Model.D216.Label
-
To get the value of the field, use: @Model.D216
<table class="table">
<thead>
</thead>
<tbody>
<tr>
<td>@Model.D216.Label</td>
<td>
<span>@Model.D216</span>
</td>
</tr>
</tbody>
</table>
Extra explanation on the code:
-
@Model is used to call the main table.
-
.D216 is the sql name of the field that used in this display.
Note that in the razor the first letter of the sql field name is a capital letter.
-
.Label is used to display the actual, user-friendly, name of the field.
Note that this is not available for all types, therefore it is also possibel to hardcode the name of the field.\
The result looks like: