Hi
I have a View in MVC 2 where I edit a "Page". A Page has a Name, Title and Content. Content is of type EditableContent, which has Width, CssClass and Columns. Columns is a List.
When I do this in the view:
<%= Html.TextBoxFor(m => m.Name) %>
It outputs the following HTML:
<input type="text" value="About Page" name="Name" id="Name">
And when I post to the Edit action in ContentController:
/// <summary>
/// Edits the specified form.
/// </summary>
/// <param name="item">The content page.</param>
/// <returns>ActionResult for edit</returns>
[HttpPost]
public ActionResult Edit(Page item)
{
if (ModelState.IsValid)
{
}
return View(item);
}
It cannot bind the Name property to item.Name. Looking up the values in Request.Form, I see the Name parameter.
If I render the textbox manually, using this:
<%= Html.TextBox("item.Name", Model.Name)%>
The value is binded perfectly to the Page instance in the controller action.
Am I doing something fundamentally wrong here?