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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:33:45+00:00 2026-05-28T15:33:45+00:00

I have this controller: public JsonResult Register(string step , GlobalOnBoardingDataModel data){} the MVC wont

  • 0

I have this controller:

public JsonResult Register(string step , GlobalOnBoardingDataModel data){}

the MVC wont deserialize the data variable.
The step variable is getting the post var into it.

I have other classes that are been deserialized fine, but this one won’t.
this is the class:

public class GlobalOnBoardingDataModel : BaseStepDataModel
    {
        public string Email = string.Empty;
        public string FirstName = string.Empty;
        public string LastName = string.Empty;
        public string PhoneAreaCode = string.Empty;
        public string PhoneCountryCode = string.Empty;
        public string PhoneNumber = string.Empty;
        public string CountryShortName = string.Empty;
        public string AccountCurrency = string.Empty;
        public float InitialDepositAmount = 0;
        public string Address = string.Empty;
        public string City = string.Empty;
        public string State = string.Empty;
        public string DateOfBirth = string.Empty;
        public string CreditCardNumber = string.Empty;
        public string CreditCardExperationDate = string.Empty;
        public bool RiskDisclosure = false;
        public bool Beneficiary = false;
        public string CVVNumber = string.Empty;
        public bool Subscribe = false;
    }

BTW, The location of the var is not an issue, seccond place working with other cases.

Edit
these are the values (from chrome):

step:one
FirstName:kjh
LastName:
CountryShortName:IL
PhoneNumber:
PhoneAreaCode:
PhoneCountryCode:
Email:Test@test.com

Thanks

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

    Assuming the post body is correct; you need to rewrite the fields and turn them in to public get/set properties.

    MVC won’t model bind to fields.

    Since you wish to have non-default defaults for your members; you can use a default ctor to set the property defaults on construction; although I would prefer the approach that doesn’t use auto-implemented properties instead:

    private string _email = string.Empty; 
    public string Email { get { return _email; } set { _email = value } } 
    

    In reality, I suppose there’s little difference at runtime – but if you use the constructor approach it’s very easy to forget adding a new default to it when adding a new property.

    MVC won’t bind to fields ultimately because it uses the System.ComponentModel.TypeDescriptor class, in a round-about way, to get the metadata used to identify model properties that are to be bound. This isn’t a bug, though, it’s by design and is a good design choice as it enables mechanisms other than reflection the ability to be used in describing model types.

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

Sidebar

Related Questions

If I have a controller like this: [HttpPost] public JsonResult FindStuff(string query) { var
I am getting some unexpected behavior from Html.EditorFor(). I have this controller: [HandleError] public
I have an action like this: public class News : System.Web.Mvc.Controller { public ActionResult
I have this controller method: public JsonResult List(int number) { var list = new
Hi I have this as one of my controllers: [HttpPost] public JsonResult GetPinPoints(string Id)
I have a JsonResult action in my MVC project... public JsonResult GetData(string term) {
this must be a newbie question. I have this method in a controller: public
I have a model like this: public PurchaseOrder { [Required] [StringLength(15)] public virtual string
I currently have a controller method that returns a JsonResult: public JsonResult EditField(int FieldID,
I have this string variable call status which is updated by a serial port

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.