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>
Using Razor’s
@
. Try this code:Did you try this?
There are several ways. For example simply using
@
like this:Or by using a
<span>
tag like this:Or using
Html.Label
helper: