Hi, I am trying to post back some data using a viewmodel i have created and it works for me for one of the projects.But I am doin this right now
public ActionResult Foo(string userkey)
{
vm.Value="Xvalue";
return View(vm);
}
[HttpPost]
public ActionResult Foo( MyViewModel vm)
{
// process input
if (inputOK)
string value=vm.Value
return RedirectToAction("Index");
return View();
}
public class MyViewModel
{
public string Value { get; set; }
public SomeClass newobj {get;set;}
}
public class SomeClass
{
public int id{get;set;}
public string str{get;set;}
}
So it on debugging never goes into the parameter method for Post although on the view i have added a form and a button that submits and the page inherits from the viewmodel.I get an error saying it expects a parameterless constructor how do I fix this ? . I wrote an post method with no parameters and it does go into that method