1
How to present a EnumDropDownListFor
as a condition? For example, if the user wishes to inform his or her sexual orientation Enum is presented. Otherwise it is not presented.
1
How to present a EnumDropDownListFor
as a condition? For example, if the user wishes to inform his or her sexual orientation Enum is presented. Otherwise it is not presented.
0
I would do so:
@if (UsuarioNaoQuerApresentarOrientacaoSexual)
{
@Html.Hidden(model => model.OrientacaoSexual, OrientacaoSexual.NaoInformado)
}
else
{
@Html.EnumDropDownListFor(model => model.OrientacaoSexual, ...)
}
Browser other questions tagged asp.net-mvc razor
You are not signed in. Login or sign up in order to post.
This User Who Rapresents Rientacaosexual is a bool type ?
– Alerf Morais
Yes, it may also be a condition that returns
bool
.– Leonel Sanches da Silva
Could you give me a full example
– Alerf Morais