title: How can I get alternate styling in <ItemTemplate> (.NET)?
body: <p>I'm using EPiServer for this website. Unlike <code>asp:DataList</code>, EPiServer:PAgeList does not have <code>AlternatingItemTemplate</code>.</p>
  
  <p>So I need to create a counter and increase this counter in my <code>&lt;ItemTemplate&gt;</code>, and then use modulus to return whuch css style to append to article / page.</p>
  
  <p>Modulus "code" - fromcode behind:</p>
  
  <pre><code> return index % 2 == 0 ? "styleA" : "styleB";
  </code></pre>
  
  <p>But I'm not abler to ad an counter and increase this in the <code>&lt;ItemTemplate&gt;</code>.</p>
  
  <p>Any suggestions much appreciated!</p>
  
  <p><strong>UPDATE</strong><br>
  Here is my EPiServer Page List controller:</p>
  
  <pre><code> &lt;EPiServer:PageList runat="server" id="pageList" SortDirection="Ascending" Count="4" OnDataBinding="pageList_OnDataBinding"&gt;
      &lt;HeaderTemplate&gt;
          &lt;ul id="articleList1"&gt;
      &lt;/HeaderTemplate&gt;
  
      &lt;ItemTemplate&gt;
              &lt;li&gt;
                     &lt;h2&gt;&lt;a href="&lt;%# Eval("LinkURL") %&gt;" title="&lt;%# Eval("PageName") %&gt;"&gt;&lt;EPiServer:Property id="Property1" PropertyName="PageName" runat="server" /&gt;&lt;/a&gt;&lt;/h2&gt;
                     &lt;div class="articleImage"&gt;
                        &lt;%# ArticleImage(Container.CurrentPage)%&gt;                            
                     &lt;/div&gt;
                     &lt;div class="introText"&gt;
                        &lt;%# IntroText(Container.CurrentPage)%&gt; 
                     &lt;/div&gt;
                     &lt;div class="readMore floatRight"&gt;&lt;a href="&lt;%# Eval("LinkURL") %&gt;" title="&lt;%# Eval("PageName") %&gt;"&gt;Les mer&lt;/a&gt;&lt;/div&gt;
              &lt;/li&gt;
      &lt;/ItemTemplate&gt;
  
      &lt;FooterTemplate&gt;
          &lt;/ul&gt;     
      &lt;/FooterTemplate&gt;
   &lt;/EPiServer:PageList&gt; 
  </code></pre>
  
  <p><strong>ANSWER</strong><br>
  I decided that using jQuery was a LOT simpler than hacking around with .NET.
  It's not my preferred solution, but it works. The code I use is this:</p>
  
  <pre><code>if (jQuery("#articleList1").length &gt; 0) {
      jQuery('li:odd').addClass("odd");
  }
  </code></pre>