C
C#•2w ago
Pointman

ASP.NET how does an actionmethod get my model?

details below
No description
11 Replies
Pointman
Pointman•2w ago
so i have this View which uses an incomming model upon clicking "submit", the post method Category/EditCategory() executes
Pointman
Pointman•2w ago
No description
Pointman
Pointman•2w ago
But my question is, how does it obtain the argument "entry"?
Pobiega
Pobiega•2w ago
through the beauty of "model binding" your <form> tag identities the controller and action it should send the data to
Pointman
Pointman•2w ago
what is this magic 😭
Pobiega
Pobiega•2w ago
its basic HTML my friend
Pointman
Pointman•2w ago
so the object sent back is the Model used?
No description
Pobiega
Pobiega•2w 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•2w ago
And the <input> tags are used to edit the attributes of the object?
No description
Pobiega
Pobiega•2w 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•2w ago
:DDDD yeee now my stuff works fine danke schnitzel