asp.net mvc - MVC <form action=@Href -
i'm doing tutorial https://www.youtube.com/watch?v=wwmuftweh6y , i'm having problem understanding why @href
doesn't work.
@href
i'm asiming should pointing update actionresult
in postscontroller
, doesn't work, , don't see problem. have postscontroller u can see in picture, , have public actionresult update
in postscontroller
. why path not found
?
i have no hair left end of tutorial!
edit: in picture underlined 2 things, kinda figured out other one.
update:
public class postscontroller : controller { //update takes (id, title, body, datetime, tags) public actionresult update(int? id, string title, string body, datetime datetime, string tags) { ....... }
you should use @url.action("update", "posts")
, it's more easy use. full list of overloaded methods here , pick 1 fits needs.
as alternative forms, use @html.beginform()
. example of usage here:
@using (html.beginform()) { @html.textbox("name"); @html.password("password"); <input type="submit" value="sign in"> }
Comments
Post a Comment