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 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 have a asp.net webapplication project that should contain a public and
Background: We have a project with many modules. We're using EntityFramework 4.2 with FluentAPI
Background We have an asp.net 4.0 web application written in C# that calls a
Background I have a basic HTML page with an iframe that points to a
Background I have a page on my ASP.NET MVC web app for users to
Background have a custom UITableCellView in which I'm using a custom UITextField that I've
Background I have a dimension table that has a single record for each day.
Background I have a custom collection that is binded to the datagridview this.datagridview.DataSource =
Background: I have a WCF service deployed on my local machine that in turns
Background: I have a css and a js that is used only by the

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.