Asp.Net MVC 5 Jquery serialize Array not map class list property in

AHSAN ALI 81 Reputation points
2023-10-01T15:19:36.39+00:00

Jquery serializeArray, not map class list property. I am passing master and detail records using Ajax post request to my

API controller List of Vias does not map; it gives a null value, but when I try this on a simple controller, it works.

How can I solve this issue with the API controller?Screenshot 2023-10-01 200734

Screenshot 2023-10-01 200819

Screenshot 2023-10-01 200927

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,417 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 61,731 Reputation points
    2023-10-01T16:33:57.73+00:00

    Jquery serializeArray, creates an array of name value pairs. In c# this would be

    
    public class NameValueModel
    {
        public string name {get;set;}
        public string value {get;set;}
    }
    
    public … (NameValueModel[] postData)
    
    

    As you trying to bind to an object, if you did a form post, rather than json, with serializeData, the binding would work.

    0 comments No comments