Bineesh Viswanath

Bineesh Viswanath

  • 1.2k
  • 404
  • 39.7k

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

May 15 2024 12:59 PM

     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)