.Net MVC UserControl - Form values not mapped to model
- by Andreas
Hi
I have a View that contains a usercontrol. The usercontrol is rendered using:
<% Html.RenderPartial("GeneralStuff", Model.General, ViewData); %>
My problem is that the usercontrol renders nicely with values from the model but when I post values edited in the usercontrol they are not mapped back to Model.General. I know I can find the values in Request.Form but I really thought that MVC would manage to map these values back to the model.
My usercontrol:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<namespace.Models.GeneralViewModel>" %>
<fieldset>
<div>
<%= Html.LabelFor(model => model.Value)%>
<%= Html.TextBoxFor(model => model.Value)%>
</div>
</fieldset>
I'm using .Net MVC 2
Thanks for any help!