Monday, 17 July 2017

MVC - Create DropDownList with prepopulated data - for instance with Yes/No


Watch this example on YouTube


@Html.DropDownList("SomeName", new[]
{
    new SelectListItem{Text="YES", Value="1" },
    new SelectListItem {Text="NO", Value="2" }
}, "", new { @id="IsActive"})

No comments:

Post a Comment