Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4025462
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:51:00+00:00 2026-05-20T10:51:00+00:00

I have 2 models in my sample MVC 3 application, SimpleModel and ComplexModel ,

  • 0

I have 2 models in my sample MVC 3 application, SimpleModel and ComplexModel, shown below:

public class SimpleModel
{
    public string Status { get; set; }
}

public class ComplexModel
{
    public ComplexModel()
    {
        Simple = new SimpleModel();
    }

    public SimpleModel Simple{ get; set; }
}

I have defined views for this models:

_SimplePartial.cshtml:

@model SimpleModel

@Html.LabelFor(model => model.Status)
@Html.EditorFor(model => model.Status)

and Complex.cshtml:

@model ComplexModel

@using (Html.BeginForm()) {

    @Html.Partial("_SimplePartial", Model.Simple)
    <input type="submit" value="Save" />
}

After submitting form, with random value entered in Status field, the value is not binded to my model. The Status field is NULL when I’m checking the model in my controller action:

[HttpPost]
public ActionResult Complex(ComplexModel model)
{
    // model.Simple.Status is NULL, why ?
}

Why is it not binded ? I don’t want to inherit models. Do I have to write my custom model binders for such simple case ?

Regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:51:01+00:00Added an answer on May 20, 2026 at 10:51 am

    Instead of:

    @Html.Partial("_SimplePartial", Model.Simple)
    

    I would recommend you using Editor templates:

    @model ComplexModel
    @using (Html.BeginForm()) 
    {
        @Html.EditorFor(x => x.Simple)
        <input type="submit" value="Save" />
    }
    

    and then put the simple partial inside ~/Views/Shared/EditorTemplates/SimpleModel.cshtml or inside ~/Views/Home/EditorTemplates/SimpleModel.cshtml where Home is the name of your controller:

    @model SimpleModel
    @Html.LabelFor(model => model.Status)
    @Html.EditorFor(model => model.Status)
    

    Of course if you prefer to have the partial in some special location and not follow the conventions (why would you?) you could specify the location:

    @Html.EditorFor(x => x.Simple, "~/Views/SomeUnexpectedLocation/_SimplePartial.cshtml")
    

    then everything will come into place as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC application with a link to print the information. the print
I have an MVC application with a link to print the information. the print
I have just started a new web application with asp.net mvc and sql server
ASP.NET MVC 2.0: Simple Model Binding not working/binding as it should i have a
I'm writing my first application with Zendframework. My question is about the Model–View–Controller (MVC)
In C# ASP.NET MVC application I use Link to SQL to provide data for
I've noticed a lot of talk about asp.net MVC lately, but I haven't come
I am creating a simple design for a social-networking site using the MVC paradigm(in
How can I mock a DataServiceQuery for unit testing purpose? Long Details follow: Imagine
Today I spent a good three hours trying to convert the project MvcContrib.Samples.InputBuilders, included

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.