0

I use web method, so I can pass string from code behind to JavaScript function. but now in code behind I have 2D array and don't know how to pass it.

1- array in code behind is the same in JavaScript? 2- do I need to convert it and send or do I need to make a string and then send? 3- is it possible to send and read array directly without any changes?

what is best and quickest way?

9
  • Did you try: new JavaScriptSerializer().Serialize(your_array) ?? Commented Sep 24, 2013 at 18:11
  • is it in code behind? i have a 2d array and need to send to javascript and there with array. Commented Sep 24, 2013 at 18:13
  • Yes, your method would: return new JavaScriptSerializer().Serialize(toReturn); assuming toReturn is your array Commented Sep 24, 2013 at 18:14
  • it doesn't work i work vs2010 Commented Sep 24, 2013 at 18:21
  • Did you reference using System.Web.Script.Serialization ? Because VS has nothing to do with it - its .Net Web assembly. Commented Sep 24, 2013 at 18:23

0

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.