Hi how can I pantener the selected value of a select after the postback? this is the code that I have in sight:
<select id="LocalidadId" name="LocalidadId" class="btn btn-secondary btn-block" asp-items="ViewBag.LocalidadId">
<option>Selecciona una localidad</option>
</select>
This is the code in the controller:
ViewData["LocalidadId"] = new SelectList(await queryLocalidades.ToListAsync(), "LocalidadId", "Localidad1", null, "Municipio1");
After submitting; again the default value is set in the select: "Select a location", but my wish is that the selected location be maintained in the select after submitting to be able to perform filtering and sorting operations in that specific location. I hope you have explained me well and that you can guide me.