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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:04:04+00:00 2026-05-16T15:04:04+00:00

Background: I have a MVC2 project and am using jQuery 1.4.2. I have a

  • 0

Background:

  1. I have a MVC2 project and am using jQuery 1.4.2.
  2. I have a .NET class that I put into a view using a JsonResult.
  3. The page then uses jQuery to do stuff which will result in properties of the object put on the page by item (2) above.
  4. When a certain page element is clicked jQuery $.post’s the JSON.stringify(myObj) back to action method.

What I’d like to be able to have is something like:

[HttpPost]
public ViewResult MyAction(MyClass minime)
{
}

… MyClass would be the .NET class to deserialize the JSON into which should be fine given it was the type MyClass that got “return Json(MyClass);”

At the present time what I’m seeing is that either the object parameter is null or has no values as set by the JS/jQuery code. If I try:

MyClass foo = new MyClass();
UpdateModel(foo);

It doesn’t throw an exception but similar doesn’t populate the class either.

Anybody have any ideas on how to solve this? Or how to deal with JSON sent back to the action method and get it into a class.

  • 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-16T15:04:04+00:00Added an answer on May 16, 2026 at 3:04 pm

    If you have an Action

    [HttpPost]
    public JsonResult MyAction(MyClass minime)
    

    where for example

    public class MyClass {
        public string Name { get; set; }
        public int Age { get; set; }
    }
    

    you should fill all properties of the class MyClass as a parameters. The input data must not be in JSON format:

    $.ajax({
        url: '/MyController/MyAction',
        data: { name: "Peter", age: 33 },
        dataType: 'json',
        traditional: true,
        type: 'POST',
        success: function (data) {
            // get data which are already deserialized from JSON
        }
    });
    

    If you have DateTime properties read JSON Date parameter passed to MVC Action is always null.

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

Sidebar

Related Questions

Background : I currently have a Web Forms, ASP.NET 3.5/C# application which I'm interested
Background We have a Windows .NET application used by our field employees who travel
Background I have a web app that will create an image from user input.
Background: I have 8 images for every sprite in my bird's view JavaScript game,
Background: I have a large 2D array of integers that I need to load
First, some background: I'm new to ASP.NET MVC 2 and NHibernate. I'm starting my
Background: I have a unit of optimised Delphi/BASM routines, mostly for heavy computations. Some
I have a breadcrumb structure similar to the image above. It displays the progress
I'm working on this menu for a intranet system. I have a menu system

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.