title: Using a repeater in C# from VB.net example
body: <p>I use repeaters in vb.net all the time and have no problems with them, however i'm working on some c# and can't work out the conversion (and an online conversion jobby didn't seem to work)</p>
  
  <p>I have my repeater set out like:</p>
  
  <pre><code>  &lt;asp:Repeater runat="server" ID="rptItems"&gt;
                  &lt;ItemTemplate&gt;
                  &lt;div class="span12 grey-box"&gt;
                              &lt;div class="hero-block3"&gt;
                                  &lt;div class="row show-grid"&gt;
                                      &lt;div class="span9"&gt;
                                          &lt;div class="hero-content-3"&gt;
                                              &lt;h2&gt;&lt;asp:Literal ID="ltrName" runat="server"&gt;&lt;/asp:Literal&gt;&lt;/h2&gt;
                                              &lt;p&gt;&lt;asp:Literal ID="ltrDescription" runat="server"&gt;&lt;/asp:Literal&gt;&lt;/p&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;
                                      &lt;div class="span3"&gt;
                                          &lt;div class="tour-btn"&gt;
                                              &lt;small&gt;How Many?&lt;br /&gt;&lt;/small&gt;
                                              &lt;asp:TextBox runat="server" ID="tbox" Width="40"&gt;&lt;/asp:TextBox&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>And heres how i'd populate it normally in vb.net</p>
  
  <pre><code>Private Sub rptItems_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptClientList.ItemDataBound
          Dim nRow As DataRowView = Nothing
  
          Select Case e.Item.ItemType
              Case ListItemType.Item, ListItemType.AlternatingItem
  
                  With e.Item
                      nRow = DirectCast(e.Item.DataItem, DataRowView)
                      With DirectCast(.FindControl("ltrText"), Literal)
                          .Text = nRow("Description")
                      End With
  
                       With DirectCast(.FindControl("ltrTitle"), Literal)
                          .Text = nRow("Name")
                      End With
  
                  End With
  
          End Select
      End Sub
  </code></pre>