title: getting index of itemcollection
body: <p>I have a datalist with products we use on our product page.  I'm generating javascript for each item in the collection using:</p>
  
  <pre><code>foreach (ProductItem item in _prod.ActiveProductItemCollection)
  {
      sb.Append("&lt;script type='text/javascript'&gt;");
      sb.Append("mboxCreate(\"product_productpage_rec\",");
  }
  </code></pre>
  
  <p>and so on...</p>
  
  <p>What I want to do is get the index of the item and append it in my stringbuilder.  I'm learning asp.net and am not quite sure how to do it.  Here is an example of how the code would generate ideally.</p>
  
  <p>first product</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  mboxCreate("deandeluca_productpage_rec1")
  &lt;/script&gt;
  </code></pre>
  
  <p>second product</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  mboxCreate("deandeluca_productpage_rec2")
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm assuming I need to do a loop of some kind but like I said before unsure of how to do one.</p>