Maximilian Ast Maximilian Ast - 1 month ago 11x
ASP.NET (C#) Question

Html.BeginForm posted Model is null

Hello I have following problem:
I tried to post a Model through a Form to an other controller-action.
But the received Model is only filled with "null" elements.
enter image description here


public class ToolController : Controller
private IDevelopmentStepProvider _devProv;

public ToolController(IDevelopmentStepProvider devtool, IToolProvider tool, IDevelopmentStepVersionsProvider versProv)
_devProv = devtool;

public ActionResult Index()
var Model = new EditToolModel();

* assigning some data to Model

return View(Model);

public ActionResult EditToolOverview(EditToolModel myModel)
return RedirectToAction("Index", "Tool", new { show = "overview" });


public class EditToolModel
public Tools tool;
public IEnumerable<Tools> tools { get; set; }

public ToolsExtention tool_extention;
public string latest_version { get; set; }
public string latest_version_type { get; set; }
public string latest_devStep { get; set; }

public IEnumerable<ToolVersionsView> versions { get; set; }
public IEnumerable<DevelopmentStep> developmentSteps { get; set; }


@model EditToolModel
ViewBag.Title = "Index";
Layout = "~/Layout/_Layout.cshtml";
@Html.Partial("ToolOverview", this.Model)


@model EditToolModel
@using (Html.BeginForm("EditToolOverview", "Tool", FormMethod.Post))
<div class="contend">
@Html.TextBoxFor(Model => Model.tool_extention.a)
@Html.TextBoxFor(Model => Model.tool_extention.b)
@Html.TextBoxFor(Model => Model.tool_extention.c)
@Html.TextBoxFor(Model => Model.tool_extention.d)
<input type="submit" id="tool_submit" name="tool_submit" value="Submit" class="btn submit"/>


You need to have a getter/setter on the tool_extention property in order for the DefaultModelBinder to work

public ToolsExtention tool_extention { get; set; }

Ditto for the tool property (but your only rendering controls for the tool_extention property in your view)