how can i access an array, defined in the form, inside javascript.
e.g
i have defined an integer array inside the web form like
<% using (Html.BeginForm())
{
int[] ctid = ViewData["ct"] as int[];
var x = 0;
%>
now i want to access this array(ctid) inside javascript, how can i do that…
You’ll need to loop through the array and write it out to a Javascript array.
You could also try the JavaScriptSerializer Class (http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx) to turn it into a JSON object