COMO COLOCO UM IF DENTRO DE UM <TD> </TD

JCM0867 23/04/2022 22:35:44
#499685
Olá pessoal,

Tenho a seguinte situação:

<tr ...>
...
<td scope="col">
@Html.Raw(Math.Round(listMedia.CalculaMedia(), 1, MidpointRounding.AwayFromZero))
</td>
</tr>

Como coloco um IF dentro do <tr> ou <td> ficando algo assim?

<tr ...>
...
<td scope="col">
[txt-color=#e80000] if (NroGraus >= 4)
{[/txt-color]
@Html.Raw(Math.Round(listMedia.CalculaMedia(), 1, MidpointRounding.AwayFromZero))
[txt-color=#e80000]}[/txt-color]
</td>
</tr>

ou Assim

<tr ...>
...
[txt-color=#e80000] if (NroGraus < 4)
{[/txt-color]
<td scope="col">
@Html.Raw(Math.Round(listMedia.CalculaMedia(), 1, MidpointRounding.AwayFromZero))
</td>
[txt-color=#e80000] }[/txt-color]
[txt-color=#e80000] else
{[/txt-color]
<td scope="col">
</td">
[txt-color=#e80000] }[/txt-color]
</tr>

Como faço a parte em vermelho?
se eu dou um pause em execução tem Valor um valor que eu pretendo no NroGraus

Grato





JABA 24/04/2022 00:51:57
#499686
Resposta escolhida
 @if(NroGraus < 4)
{
<td scope="col">
@Html.Raw(Math.Round(listMedia.CalculaMedia(), 1, MidpointRounding.AwayFromZero))
</td>
}

JCM0867 24/04/2022 10:40:07
#499687
Seu certo, Valeu
Tópico encerrado , respostas não são mais permitidas