I need to pass a js multidimensional array (the dimensions are not known at compile time) to my code-behind in c#, I have done this in the next way:
var AdjustItems = ""; //My string variable to store the array separated with '|' and '-'
for (var i = 0; i < adjusts.length; i++) { //adjusts is my js array
AdjustItems += adjusts[i].Motive + '|' + adjusts[i].Amount.toFixed(2).toString() + '-';
}
if (AdjustItems != "") {
AdjustItems = AdjustItems.substring(0, AdjustItems.length - 1);
}
g('arrAdjust').value = AdjustItems; //arrAdjust is my hidden input.
Is there another way to do this where I can get the array, like an array and not like a string in c#?