3
Answers

How to set a selected values in <select asp-for>

Bineesh Viswanath

Bineesh Viswanath

May 15
408
1

     I have created a dropdown and assigned a api to fetch data into this. This one is working fine during save process. but i could not able to set the saved value in this dropdown since each time the api call is happening during page load. how can i set a selected value in this dropdown based on a branch Id. 

 <select asp-for="@Model.BranchId" id="branchIdSelect"
       class="auto-complete-select"
       data-autocomplete-api-url="api/app/branch-settings/branches-from-server/"
       data-autocomplete-display-property="name"
       data-autocomplete-value-property="id"
       data-autocomplete-filter-param-name="name"
       data-autocomplete-allow-clear="true">

Answers (3)