Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TestObject
- {
- public string Name { get; set; }
- public int Age { get; set; }
- }
- <form action="/Create" method="post">
- <p>
- <%=Html.TextBox("Name") %>
- </p>
- <p>
- <%=Html.TextBox("Age")%>
- </p>
- </form>
- [AcceptVerbs(HttpVerbs.Get)]
- public ActionResult Create()
- {
- return View(new TestObject { Name = "DefaultName", Age = 10 } );
- }
- [AcceptVerbs(HttpVerbs.Post)]
- public ActionResult Create(TestObject o)
- {
- o.Name = "ChangedNameToSomethingElse";
- o.Age = 15;
- return View(o);
- }
Add Comment
Please, Sign In to add comment