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 4603900
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:13:06+00:00 2026-05-22T00:13:06+00:00

My app is using JavascriptMVC on the client side, and ASP MVC is basically

  • 0

My app is using JavascriptMVC on the client side, and ASP MVC is basically functioning only as a REST service. Here’s a typical controller method:

public JsonResult Update(CustomerDto dto)
{
  var repository = Factory.NewCustomerRepository())
  // ... Convert DTO back to entity and save changes
  return Json(dto);
}

The problem is, my CustomerDTO contains some properties that aren’t getting converted from the form data into the objects that they should be. For example, PhoneNumbers:

public class CustomerDto
{
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string MiddleName { get; set; }
    public string LastName { get; set; }
    public PhoneNumberDto[] PhoneNumbers { get; set; }
    // ... more properties
}
public class PhoneNumberDTO
{
    public int Id { get; set; }
    public int CustomerId { get; set; }
    public string Label { get; set; }
    public string Number { get; set; }
}

In the controller action, PhoneNumbers will have the correct number of elements in the array, but each object will have only null/default values. I’ve verified that the request is sending all of the appropriate form data:

Id          26
FirstName   A
LastName    Person
MiddleName  Test
PhoneNumbers[0][CustomerID  26
PhoneNumbers[0][Id] 5
PhoneNumbers[0][Label]  Mobile
PhoneNumbers[0][Number] (555)555-5555
PhoneNumbers[1][CustomerID  26
PhoneNumbers[1][Id] 8
PhoneNumbers[1][Label]  Home
PhoneNumbers[1][Number] (654)654-6546

Any ideas on what could be going on? Am I just wrong in thinking that MVC3 can map nested objects from the form values automatically? Thanks for any help!

  • 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-22T00:13:07+00:00Added an answer on May 22, 2026 at 12:13 am

    Actually the request should look like this if you want the default model binder to successfully bind those values (notice PhoneNumbers[0].CustomerID instead of PhoneNumbers[0][CustomerID]):

    Id                          26
    FirstName                   A
    LastName                    Person
    MiddleName                  Test
    PhoneNumbers[0].CustomerID  26
    PhoneNumbers[0].Id          5
    PhoneNumbers[0].Label       Mobile
    PhoneNumbers[0].Number      (555)555-5555
    PhoneNumbers[1].CustomerID  26
    PhoneNumbers[1].Id          8
    PhoneNumbers[1].Label       Home
    PhoneNumbers[1].Number      (654)654-6546
    

    You may take a look at the following blog post for the wire format used for collections.

    As an alternative you could use JSON requests.

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

Sidebar

Related Questions

I'm writing an app using asp.net-mvc deploying to iis6. I'm using forms authentication. Usually
I am developing an app using Grails and GWT for a client side. I
I've got an ASP.NET app using NHibernate to transactionally update a few tables upon
I'm writing a client-server app using BSD sockets. It needs to run in the
Anyone had a chance to use the javascript MVC framework with ASP.NET MVC? Basically
I have a basic app using the ASP.NET membership provider. By default, you can
I have an app using PHP and the PayPal API. The basic way it
As part of a larger web-app (using CakePHP), I'm putting together a simple blog
This link describes an exploit into my app using fckEditor: http://knitinr.blogspot.com/2008/07/script-exploit-via-fckeditor.html How do I
I am writing a web app using TurboGears, and in that app the users

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.