title: Looping through values from c# array using javascript
body: <p>Okay, I've created an array in c# and want to access the values in a javascript for loop. Here's my global c# variables:</p>
  
  <pre><code>protected int count;
  protected string[] arr = new string[20];
  </code></pre>
  
  <p>From there I add string values to the array in, let's say, the Page_Load() event.</p>
  
  <p>And here's my ideal javascript code:</p>
  
  <pre><code>var count = &lt;%= count %&gt;;
  for (var i = 0; i &lt; count; i++) 
  {
  document.write(&lt;%= arr[i] %&gt;);
  }
  </code></pre>
  
  <p>Now if I were to just use arr[0] that would pop up with the correct information for arr[0], so I know I've got that part right, but is there a way to use that javascript variable "i" inside the &lt;%= %> tag?</p>