ASP.NET how does an actionmethod get my model?

details below
No description
11 Replies
☠  Pointman ☠
☠ Pointman ☠OP8mo ago
so i have this View which uses an incomming model upon clicking "submit", the post method Category/EditCategory() executes
☠  Pointman ☠
☠ Pointman ☠OP8mo ago
No description
☠  Pointman ☠
☠ Pointman ☠OP8mo ago
But my question is, how does it obtain the argument "entry"?
Pobiega
Pobiega8mo ago
through the beauty of "model binding" your <form> tag identities the controller and action it should send the data to
☠  Pointman ☠
☠ Pointman ☠OP8mo ago
what is this magic 😭
Pobiega
Pobiega8mo ago
its basic HTML my friend
☠  Pointman ☠
☠ Pointman ☠OP8mo ago
so the object sent back is the Model used?
No description
Pobiega
Pobiega8mo ago
a <form> tag with method="post" will send its data in a certain way, essentially a collection of key-value pairs yes but that doesnt actually matter it just lets asp help you more but you could just as well not set a model, and not use asp-for tags etc it would still work, due to how the model binder works
☠  Pointman ☠
☠ Pointman ☠OP8mo ago
And the <input> tags are used to edit the attributes of the object?
No description
Pobiega
Pobiega8mo ago
input is what creates an editable control in HTML yes the asp-for tag associates the input with the given model property
☠  Pointman ☠
☠ Pointman ☠OP8mo ago
:DDDD yeee now my stuff works fine danke schnitzel

Did you find this page helpful?