ASP.NET MVC 3 Razor: Passing Data from View to Controller

后端 未结 2 446
时光说笑
时光说笑 2020-12-16 02:36

I\'m brand new to all things .NET. I have a very basic web page with an HTML form. I want \'onsubmit\' to send the form data from the View to the Controller. I\'ve seen s

2条回答
  •  轮回少年
    2020-12-16 03:02

    Defining a form in the following way:

    @using (Html.BeginForm("ControllerMethod", "ControllerName", FormMethod.Post))

    Will make a call to the method "ControllerMethod" in the controller "ControllerName". In the method you can accept a model, or other data types as inputs. See this tutorial for examples using forms and razor mvc.

提交回复
热议问题