Include direct input select - MVC

Asked

Viewed 34 times

0

I have this select field, where I upload the database data:

<label asp-for="CategoriaID" class="col-md-2 control-label"></label>
<div class="col-md-6">
    <select asp-for="CategoriaID" asp-items="@Model.CountryList" class="form-control"></select>
    <span asp-validation-for="CategoriaID" class="text-danger"></span>
</div>

But the need for the user to be able to include directly in this field, would it be possible ? Because when checking in select, there may not be a category, so it could type, and include in the bank.

  • 2

    I believe it’s more of a design decision than a programming decision. You may have a "Include categories" button, or you may have an "Other" option in your Select... the solution will depend on how you intend to address the issue.

  • @Brunosoares I wish he could have the option to type in select, by clicking enter, ask if he would like to include in the bank, and then include.

  • I get it, select itself is not possible natively, but there are bootstrap or jquery components that can help you. A simpler solution would actually be an "Other" option, which when selected displays a textbox for typing.

  • @Brunosoares thought to do this then through a modal, and load again the select without refresh on the page.

  • It is a great exit, if you have knowledge of ajax necessary, recommend =)

  • 1

    I did it that way, and with ajax, thank you.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.