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.
Html select tag - How to populate a field depending on which one I choose in a list view
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
1 additional answer
Sort by: Most helpful
-
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