Here I am trying to display variable y
value in td
in view(i.e .cshtml).
But have no idea how to do that.
Below is my view:
<td>
@Html.DisplayFor(modelItem => item.District)
</td>
<td>
@{
var y = v.GetContestantAverageRatingByContestantId(item.ContestantId);
}
</td>
There are several ways. For example simply using @
like this:
<td>
@y
</td>
Or by using a <span>
tag like this:
<span>Your Text @(y) ...</span>
Or using Html.Label
helper:
@Html.Label("lblName", y)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With