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

  • SEARCH
  • Home
  • 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 3235218
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:28:53+00:00 2026-05-17T17:28:53+00:00

Looks like others have had this problem but I can’t seem to find a

  • 0

Looks like others have had this problem but I can’t seem to find a solution.

I have 2 Models: Person & BillingInfo:

public class Person
{
 public string Name { get; set;}
 public BillingInfo BillingInfo { get; set; }
}

public class BillingInfo
{
 public string BillingName { get; set; }
}

And I’m trying to bind this straight into my Action using the DefaultModelBinder.

public ActionResult DoStuff(Person model)
{
 // do stuff
}

However, while the Person.Name property is set, the BillingInfo is always null.

My post looks like this:

“Name=statichippo&BillingInfo.BillingName=statichippo”

Why is BillingInfo always null?

  • 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-17T17:28:54+00:00Added an answer on May 17, 2026 at 5:28 pm

    Status no repro. Your problem is elsewhere and unable to determine where from what you’ve given as information. The default model binder works perfectly fine with nested classes. I’ve used it an infinity of times and it has always worked.

    Model:

    public class Person
    {
        public string Name { get; set; }
        public BillingInfo BillingInfo { get; set; }
    }
    
    public class BillingInfo
    {
        public string BillingName { get; set; }
    }
    

    Controller:

    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            var model = new Person
            {
                Name = "statichippo",
                BillingInfo = new BillingInfo
                {
                    BillingName = "statichippo"
                }
            };
            return View(model);
        }
    
        [HttpPost]
        public ActionResult Index(Person model)
        {
            return View(model);
        }
    }
    

    View:

    <% using (Html.BeginForm()) { %>
        Name: <%: Html.EditorFor(x => x.Name) %>
        <br/>
        BillingName: <%: Html.EditorFor(x => x.BillingInfo.BillingName) %>
        <input type="submit" value="OK" />
    <% } %>
    

    Posted values: Name=statichippo&BillingInfo.BillingName=statichippo is perfectly bound in the POST action. Same works with GET as well.


    One possible case when this might not work is the following:

    public ActionResult Index(Person billingInfo)
    {
        return View();
    }
    

    Notice how the action parameter is called billingInfo, same name as the BillingInfo property. Make sure this is not your case.

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

Sidebar

Related Questions

I have a problem others had before but I can't get anywhere with the
Looks like this question has been asked thousand times already, but each person's configuration
I have searched high and low, but cannot seem to find a solution to
I have a XML document that looks like this: <Person> <LastName>LastName1</LastName> <FirstName>FirstName1</FirstName> <MiddleName>MiddleName1</MiddleName> </Person>
I have a struct that looks like this: typedef struct _my_struct { float first_vector[SOME_NUM][OTHER_NUM];
Looks like the options are Propel, Doctrine, and ActiveRecord, others?, but I am only
I have an INSERT statement that looks like this: INSERT INTO officer (officer_number, name,
This looks like a basic IB error but it hasn't worked out to be.
i know this question might look like a duplicate. but i had a hard
I know this seems pretty basic, and it should be, but I can't find

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.