title: Repeater items data all use source items data for data
body: <p>Okay so I have a repeater:</p>
  
  <pre><code>&lt;asp:Repeater ID="myRepeater"  OnItemDataBound="myRepeater_ItemDataBound" runat="server"&gt;
  
      &lt;HeaderTemplate&gt;
      &lt;/HeaderTemplate&gt;
  
      &lt;ItemTemplate&gt;
  
      &lt;sc:sublayout ID="scSublayout" Path="/Components/Spot/BlurbSpot.ascx" runat="server" /&gt;
  
      &lt;/ItemTemplate&gt;
  
  &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>Data is binded like this:</p>
  
  <pre><code>myRepeater.DataSource = Sitecore.Context.Item.GetChildren();
  myRepeater.DataBind();
  </code></pre>
  
  <p>My item databound gets the datasource and applies it to the sc:sublayout:</p>
  
  <pre><code>protected void myRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
  {
      if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
      {
          var scSublayout = e.Item.FindControl("scSublayout") as Sitecore.Web.UI.WebControls.Sublayout;
  
           if (scSublayout != null)
           {
               scSublayout.DataSource = ((Sitecore.Data.Items.Item)e.Item.DataItem).ID.ToString();
           }
      }
  } 
  </code></pre>
  
  <p>It display two items, but both items display data from the second datasource. Debugging I can see it finds both, but the original values for the 1st loop get written over for some reason.</p>
  
  <p>What I want is both items being display, and the first item that gets looped over not to have its variables written over.</p>
  
  <p>@Mark Ursino</p>
  
  <pre><code>public partial class BlurbSpotSublayout : Logic.BaseSublayout
  {
  
      public static string Blurb_Spot_Heading;
      public static string Blurb_Spot_SubHeading;
      public static string Blurb_Spot_Abstract;
  
      private void Page_Load(object sender, EventArgs e) 
      {
          if (DataSource != null)
          {
              Blurb_Spot_Heading = BlurbSpot.GetInstance(DataSource.Paths.FullPath.ToString()).Heading;
              Blurb_Spot_SubHeading = BlurbSpot.GetInstance(DataSource.Paths.FullPath.ToString()).SubHeading;
              Blurb_Spot_Abstract = BlurbSpot.GetInstance(DataSource.Paths.FullPath.ToString()).BlurbAbstract;
          }
  
      } 
  </code></pre>
  
  <p>Front-end is:</p>
  
  <pre><code>&lt;div ID="Div3" runat="server"&gt;&lt;%=Blurb_Spot_SubHeading%&gt;&lt;/div&gt;
  &lt;div ID="Div1" runat="server"&gt;&lt;%=Blurb_Spot_Heading %&gt;&lt;/div&gt;
  &lt;div ID="Div2" runat="server"&gt;&lt;%=Blurb_Spot_Abstract%&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Then I pass the item to a class behind by doing:</p>
  
  <pre><code>Database webDB = Sitecore.Configuration.Factory.GetDatabase("web");
  Sitecore.Data.Items.Item item;
  this.item = webDB.Items[item];
  </code></pre>
  
  <p>GetInstance().Heading does this:</p>
  
  <pre><code>public string Heading
      {
          get
          {
              if (item != null)
              {
  
                      Sitecore.Data.Fields.Field field = item.Fields["BlurbSpot_Content_Header"];
  
                      if (field != null)
                      {
                          return field.Value;
                      }
                      else
                      {
                          return _heading; // returns default pixel width if BlurbSpot_Heading is not define, or is null
                      }
              }
  
              return _heading;
  
          }
  
          set
          {
              _heading = value;
          }
      }
  </code></pre>