ASP.Net Core | NET Core MVC POST
InthisarticleIwillexplainwithanexample,howtosubmit(post)aFormandsenddatafromViewtoControllerinASP.NetCoreMVC. ThisarticlewillexplainhowtocreateFormFieldsandthensenddatafromViewtoControllerusingFormCollectioninASP.NetCoreMVC. Controller TheControllerconsistsoftwoActionmethodswiththenameIndex,oneforhandlingtheGEToperationwhileotherforhandlingthePOSToperation.TheActionmethodforPOSToperationacceptsthevaluesofFirstNameandLastNamesentfromtheViewanditisassignedtoaViewBa...
In this article I will explain with an example, how to submit (post) a Form and send data from View to Controller in ASP.Net Core MVC.
This article will explain how to create Form Fields and then send data from View to Controller using Form Collection in ASP.Net Core MVC.
Controller
The Controller consists of two Action methods with the name Index, one for handling the GET operation while other for handling the POST operation.
The Action method for POST operation accepts the values of First Name and Last Name sent from the View and it is assigned to a ViewBag[1] object.public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
[HttpPost]
public IActionResult Ind...