Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all, I want to initailize Return an 2D string array from ASP static WEbMethod to Javascript function
as a Return value but i can't do it

for example, in ASP Method:
C#
[WebMethod]
public static string[,] Method(string id)
{
string[,] str; // the number of rows and columns are unknowned

for(int i=0; i < 10 ; i++)
    str[0,10] = "Test Value";// this initialization does not work

return str;
}


JavaScript
function myFunction() {
            $.ajax({
                type: "POST",
                url: "./page.aspx/Method",
                data: '{"id":"' + input + '"}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                        var items = [,];
                        alert(items);
                }
            });
}
Posted
Updated 12-Feb-13 13:59pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900