.Net MVC UserControl - Form values not mapped to model

Posted by Andreas on Stack Overflow See other posts from Stack Overflow or by Andreas
Published on 2010-05-04T11:52:38Z Indexed on 2010/05/04 11:58 UTC
Read the original article Hit count: 503

Filed under:
|
|
|

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!

© Stack Overflow or respective owner

Related posts about .NET

Related posts about mvc