0

I am passing a array from javascript to server that looks something like this:

tableGrid: 
[
   [
      ["row0cell0", "row0cell1", "row0cell2", "row0cell3", "row0cell4"],
      ["row1cell0", "row1cell1", "row1cell2", "row1cell3", "row1cell4"]
   ]
]

I need to pass it to C# Web API, so at the moment I want to add it to a existing model that I created for the table, so i put this on my model:

public List<Array> tableGrid { get; set; }

I want to access the elements as I do with a multimensional array like arr[2][2], any tip guys?

1 Answer 1

1

You can add a list of list of string like:

public List<List<string>> tableGrid { get; set; }

put that in a class myClass and add it to [FromBody] in your controller.

public PostData([FromBody] myClass) {

}

Then you should send it via POST from JavaScript.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.