Good afternoon, gentlemen.
I use DropDownListFor
to load lists, example load all my clients to be selected. However, I need that if a record does not appear in the listing have the option to add a new item.
I can write the code, however the problem is that the item to add a new record is at the end of my list, I would like it to be the second item. The first item is to select, second new and the others that are registered.
@Html.DropDownListFor(model => model.ClienteId, new SelectList(@ViewBag.Clientes, "Id", "Nome") ,"Selecione")
JS:
$('#ClienteId').append($('<option>', { text: "Novo", value: 0, selected: false }));