Answer the question
In order to leave comments, you need to log in
Simple ASP.NET MVC Form Data Submission?
I'm trying to pass data from one form to another without helper methods.
Model
public class something
{
public string SomethingField;
}
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ViewResult Form(something someObj)
{
return View("Form",someObj);
}
}
@{
ViewBag.Title = "View1";
}
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<form action="/Home/Form" method="post">
<input type="text" name="SomethingField" />
<input type="submit" value="Отправить" />
</form>
</body>
</html>
@model MvcApplication2.Models.something
@{
ViewBag.Title = "Form";
}
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
@Model.SomethingField
</body>
</html>
Answer the question
In order to leave comments, you need to log in
It turns out you need to use properties, not fields, for the default convention to work.
Read the lessons on creating a disc store and a movie catalog for mvc3/4 from the site, a lot will become clear to you. but there are only the basics, there are no helpers ..
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question