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

Helio Viegas 21 Reputation points
2022-06-25T14:43:46.63+00:00

Hi,

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>
</select>
<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>

Thanks

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,774 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 71,101 Reputation points
    2022-06-25T16:49:53.14+00:00

    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.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Helio Viegas 21 Reputation points
    2022-06-25T18:14:48.617+00:00

    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


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.