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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:53:00+00:00 2026-06-09T15:53:00+00:00

I am using ASP.NET MVC 3 and I’m trying to model bind a simple

  • 0

I am using ASP.NET MVC 3 and I’m trying to model bind a simple json array to a List<JsonPositions>. JsonPositions is a custom object with the same properties as the json objects in the array.

Here is what my array looks like on the client:

var widgetPositions = [
    { col: 5, row: 1, id: 2 },
    { col: 4, row: 5: id: 40 }
];

$.ajax({
    url: 'the url',
    data: { positions: widgetPositions },
    success: function () {
        alert('Save successful.');
    },
    error: function () {
        alert('An error occurred while trying to update the widget positions.');
    }
});

This code appears to be working correctly when the request is examined in Chrome.

In the controller we have the following action method:

public void UpdatePositions(List<JsonPosition> positions)
{
    // debugging here
}

When I examine the widgetPositions list it does have two items just like the json array, but the objects’ properties do not match the values from the objects on the client. Here is what the object JsonPosition looks like:

public class JsonPosition
{
    public int id { get; set; }
    public int col { get; set; }
    public int row { get; set; }
}

Thanks for any help you can offer 🙂

  • 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-06-09T15:53:01+00:00Added an answer on June 9, 2026 at 3:53 pm

    I think you may need to add the content-type:

    $.ajax({
        url: 'the url',
        data: JSON.stringify({ positions: widgetPositions }),
        contentType: 'application/json',
        success: function () {
            alert('Save successful.');
        },
        error: function () {
            alert('An error occurred while trying to update the widget positions.');
        }
    });
    

    Also you’re not specifying a request type, so it will do a GET by default, do you mean to be doing a POST? That would make it

    $.ajax({
        url: 'the url',
        type: 'POST',
        data: JSON.stringify({ positions: widgetPositions }),
        contentType: 'application/json',
        success: function () {
            alert('Save successful.');
        },
        error: function () {
            alert('An error occurred while trying to update the widget positions.');
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Asp.net MVC 3 and Json.net library. I have view model class
Using Asp.net MVC, I have one view that's strongly bind to List , and
I'm using ASP.NET MVC 3 and have my custom model binder. public class NewsModelBinder
Using ASP.NET MVC when trying to get the information stored on my Session[objectName] from
When using ASP.NET MVC plus Entity Framework, and trying to implement a generic repository
I am using ASP.Net MVC with ADO.Net Entity Data Model. When I use ToList()
I am using ASP.Net MVC 2 and have trouble getting a DropDownList to bind
using ASP.NET MVC, I have a Model, to which I'm attaching attributes so that
Using ASP.NET MVC I am creating a custom Authorize attribute to take care of
I am using asp.net mvc 3 jquery validate unobstructive javascript. I am trying to

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.