Hello,
There are number ways available in mvc to pass the data from view to controller. it depends on what's the story on your application means where you want to pass the data in controller ,POST or In GET Method.
In
GET Method you can pass the value by calling action using java script or jqury.
I will explain you how to pass value from view to POST Method in controller by using in "
FormCollection"
FormCollection is generic collection in which value store in "key-Value" pair. but you can get value from this only on POST Method.
refer following code stuff.
In View
@using(Html.BeginForm("actionName","ControllerName",FormMethod.Post))
{
@Html.Editor("Key","Value")
}
In Controller
[HttpPost]
public ActionResult ActionName(FormCollection coll)
{
string value = coll["Key"];
}
In this way also you can pass the value from view to controller
POST Method.