How does @Html.BeginForm() works?

后端 未结 4 1356
栀梦
栀梦 2020-12-05 14:19

I\'m very new to ASP.NET, just started the MVC tutorial today on asp.net. I got here http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/examining-the-ed

4条回答
  •  醉酒成梦
    2020-12-05 15:05

    We can create forms by typing simple html or by html helpers. One of them Html.BeginForm(); it is a little bit odd because you actually can wrap it in a using statement because this particular helper returns an object that implements IDisposable in C#. First it writes out with opening tag. And at the bottom when the generated code calls dispose on that object, that’s when it will write out closing form tag . So BeginForm gives me an object that will write out my opening form tag and my closing from tag. After that you don't worry about anything you can just focus on labels and inputs

提交回复
热议问题