title: How to Get Count of Items in Repeater inside ItemDataBound
body: <p>I have one <code>Repeater</code> </p>
  
  <pre><code>&lt;asp:Repeater runat="server" ID="rptID" OnItemDataBound="repID_ItemDataBound"&gt;
           &lt;ItemTemplate&gt;
           &lt;a href='example.com/somepage.aspx' id="myLink"&gt;
                   &lt;%# Eval("MyVal")%&gt; 
           &lt;/a&gt;
          &lt;/ItemTemplate&gt;
  &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>In Code Behind I need to add one css class for this <code>&lt;a&gt;</code> tag when in repeater is one
  Item</p>
  
  <pre><code>protected void repID_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || 
            e.Item.ItemType == ListItemType.AlternatingItem)
        {
            //how to set this class only then count of items is equal with 1
            ((HtmlGenericControl)e.Item.FindControl("myLink")).Attributes
                                                       .Add("class", "Count1");
        }
    }
  </code></pre>