Html select tag - How to populate a field depending on which one I choose in a list view

Helio Viegas 21 Reputation points


I'm looking for a solution to populate the fields related when choice in the list view.

At this moment I choose an option and after refreshing it populates the related fields.
Below my code:

<select asp-for="Property.Prop_Owner_Id" asp-items="@默 .OwnerList" class="form-select">
<option disabled selected>--Select Owner--</option>
<span asp-validation-for="Property.Prop_Owner_Id" class="text-danger"></span>

And want populate:

<input asp-for="Property.Owner.Own_EMail_1st_Holder" class="form-control" readonly />
<span asp-validation-for="Property.Owner.Own_EMail_1st_Holder" class="text-danger"></span>


A set of technologies in the .NET Framework for building web applications and XML web services.
2,599 questions
No comments
{count} votes

Accepted answer
  1. Bruce ( 28,276 Reputation points

    Server code for the page can only run if a form submit is done (refresh). If you don’t want this, the common approach is JavaScript and Ajax. Google cascading dropdowns for example code.

    No comments

1 additional answer

Sort by: Most helpful
  1. Helio Viegas 21 Reputation points

    Thanks for the reply,

    In Razor view pages there is asp-route-id and asp-action, but it only works with the attribute <a>?

    Thank you for your help,
    Hélio Viegas