I need to do some calculations on an ASP.NET MVC View, an action different than the form submission. I've tried various methods of passing the current Model on to a new controller action via an ActionLink, but the model doesn't appear to be passed.
public ActionResult Calculate(MuralProject proj)
{
ProjectFormRepository db = new ProjectFormRepository();
List<Constant> constants = db.GetConstantsByFormType(FormTypeEnum.Murals);
proj.Materials = new MuralMaterials();
proj.Materials.Volunteers = this.GetVolunteerCount(constants, proj);
this.InitializeView();
return View("View", proj);
}
What would my Html.ActionLink syntax need to be in order for me to call this and have the returning view have the same model data (with the calculated changes)? Alternately, is there another way to accomplish this?
I also tried an Ajax.ActionLink method but I ran into the same problem
Edit: "Give your submit buttons a name, and then inspect the submitted value in your controller method" method shown here is what I was looking for.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…