This weekend a lot of struggle with a View Component.
I try to add a dropdownlist that does an auto postback onchange. This dropdownlist is on a view component.
I have 2 problems:
- I don't get the asp-page-handler after the post, does it work like I implemented it on the form-tag?
- Post calls method public void OnPost on razor page containing view component. I would think it would be better to have a method on the View Component like OnChangeProject?
The code of my View (View Component):
<form asp-page-handler="ChangeProject" method="post">
@Html.AntiForgeryToken()
@Html.DropDownList("id", new SelectList(Model, "Id", "Id"), new { onchange = "this.form.submit()" })
</form>
Thanks in advance!!