title: passing VB.net array to javascript using ClientScript class
body: <p>I am trying to use the ASP.net class ClientScript to pass an array to my aspx page. I have succesfully completed an earlier sample to do this (code sample below). But a new routine is not working. The difference is the ClientScript class. </p>
  
  <p>Error states that "routeCoords is undefined"</p>
  
  <p>my java code is...</p>
  
  <pre><code>function newTest() {
      var myArray = [ , ];
      var n = 0;
  
      var recCount = routeCoords.length / 15;
  
      for (var i = 0; i &lt; recCount ; i++) {
          for (var s = 0; s &lt; 15; s++) {
  
              myArray[i, s] = routeCoords[n];
              n++;
  
              alert(myArray[s], [i]);
          }
      }
  }
  </code></pre>
  
  <p>vb.net to build array and register the script....</p>
  
  <pre><code> ' arrylist
   For p = 0 To arryLst.Count - 1
       Page.ClientScript.RegisterArrayDeclaration("routeCoords", arryLst(p))
   Next
  
  Dim strScript As String = "newTest();"
  ClientScript.RegisterStartupScript(GetType(Page), "newTest", strScript.ToString, True)
  </code></pre>
  
  <p>the array is correctly populating in vb.net</p>
  
  <p>this is the routine from the sample that is working...</p>
  
  <p>VB.net code:</p>
  
  <pre><code>For s = 0 To arryLst.Count - 1
      Page.ClientScript.RegisterArrayDeclaration("parmTypeAry", arryLst(s))
  Next
  </code></pre>
  
  <p>JAVA code: </p>
  
  <pre><code>  // Create and Element Object of type "option"
    var opt = document.createElement("option");
    //Add the option element to the select item
    listID.options.add(opt);
    //Reading Element From Array
    opt.text = parmTypeAry[s];
  </code></pre>
  
  <p>which populates a dropdownlist box.</p>