1
In my system I have a select which returns the recorded data in your database table, the problem is that the list already starts with the first record automatically, and I need her to return a standard text and below the table data for choice, for example "Select", do not know how to add this text by default in my select, follow the codes:
cshtml:
<div class="form-group col-md-2">
<label>PA</label>
<select class="form-control" id="PaId" asp-for="PaId" asp-items="ViewBag.PaId"></select>
<span asp-validation-for="PaId" class="text-danger"></span>
</div>
Controller:
public IActionResult NovoChamado()
{
ViewData["PaId"] = new SelectList(_context.PAs,"PaId", "Nome");
ViewData["FornecedorId"] = new SelectList(_context.Fornecedores, "FornecedorId","Empresa");
ViewData["StatusId"] = new SelectList(_context.ChamadoStatus, "StatusId","Situacao");
return View();
}
It worked, thank you very much
– João