c# - MVC: what code gets called when you click the "submit" button? -
mvc newbie question; i'm learning playing around rather reading manual... :) i see when create "edit" view auto-generated view includes "submit" button: <input type="submit" value="save" /> but code gets called behind scenes save? specifically, model underlying view has own fancy save logic in code want call. how view invoke code instead of whatever standard code being called invisibly behind scenes? it call whatever public action method form action pointing on controller. can call save on view model. public virtual actionresult save(myviewmodel model) { model.save(); --- more code stuff here } set form action mycontroller/save you can use using (html.beginform... in code point form specific action method on specific controller.