Ajaxpro:How to transmit javascript multidimensional array to the ajaxpro method in frontpage

1k views Asked by At

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

1

There are 1 answers

1
Asim On

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;
}