Display an EnumDropDownListFor a condition

1

How do I display EnumDropDownListFor as a condition? For example, if the user wishes to report their sexual orientation, enum is displayed. Otherwise it is not displayed.

    
asked by anonymous 15.05.2017 / 01:36

1 answer

0

I would do so:

@if (UsuarioNaoQuerApresentarOrientacaoSexual)
{
    @Html.Hidden(model => model.OrientacaoSexual, OrientacaoSexual.NaoInformado)
}
else
{
    @Html.EnumDropDownListFor(model => model.OrientacaoSexual, ...)
}
    
15.05.2017 / 02:05