1

Suppose I have a c# method need array parameter:

[AjaxPro.AjaxMethod]
public int Test3(string[,] array)
{
    return array.Length;
}

then I define multidimensional array in front page with javascript:

   var array = [
        ["a", "b", "c", "d"],
        ["a", "b", "c", "d"],
        ["a", "b", "c", "d"]
    ];

I want pass the array parameter to the c# method:

alert(Get_Data.Test3(array).value);

but alert null

So how can I pass the array parameter correctly into the c# method?

thank you

hh54188
  • 14,887
  • 32
  • 113
  • 184

1 Answers1

2

You need to use AjaxPro.JavaScriptArray data-type to receive arguments at server side, e.g.:

[AjaxPro.AjaxMethod]
public int Test3(AjaxPro.JavaScriptArray array)
{
    return array.Count;
}
nothingisnecessary
  • 6,099
  • 36
  • 60
Asim
  • 118
  • 6