i've tried to send a class with two list with ajax to an mvc controler.
MVC Controler :
[HttpPost]
public JsonResult AfficherDetailsFacture(AfficheDetails afficheDetailsFacture)
{
// do some stuff
}
C# Class for the controler argument:
[Serializable]
public class AfficheDetails
{
public List<long> firstList{ get; set; }
public List<long> secondList{ get; set; }
public string numFacture{ get; set; }
}
JS :
var AfficheDetails = {
firstList: [31025,6954],
secondList: [31542,31211,23214,23211],
numFacture: "Facture 001"
};
$.ajax({
type: "POST",
async: false,
url: urls.urlAfficherDetailsFacture,
contentType: 'application/json',
data: JSON.stringify(AfficheDetails),
success: function (oResultat) {
//
}
This is NOT working properly.
If firstlist has less element than secondList, then firstList is null in the MVC controller.
i've been working several hours to discover this "rule". If firstList has more element or the same ammount, it is working !
Is it a MVC Binding bug ?