title: How do I bind my nested repeater to its parent based on current ID of parent?
body: <p>I have a 2 tables in SQL Server. One table has a list of all superheros and the other table is a list of  abilities. Currently at runtime the child repeater gets all items in the table when it should only get the items pertaining to the parent table. On my aspx page I have a nested repeater like so:</p>
  
  <pre><code>&lt;asp:Repeater id="rptHero" runat="server" DataSourceID="sdsHeros" OnItemDataBound="rptHero_ItemDataBound"&gt;
      &lt;ItemTemplate&gt;
          &lt;table&gt;
              &lt;tr&gt;
              &lt;td&gt; &lt;%# Eval("HeroName")%&gt; &lt;/td&gt;                        
                  &lt;asp:Repeater id="rptAbility" runat="server" &gt;                 
                    &lt;ItemTemplate&gt;                     
                      &lt;tr&gt;
                          &lt;td&gt; &lt;%# Eval("AbilityName")%&gt; &lt;/td&gt;                     
                      &lt;/tr&gt;
                    &lt;/ItemTemplate&gt;
                 &lt;/asp:Repeater&gt;               
              &lt;/tr&gt;
          &lt;/table&gt;
          &lt;p&gt;&amp;nbsp;&lt;/p&gt;            
      &lt;/ItemTemplate&gt;
  &lt;/asp:Repeater&gt;
  &lt;asp:SqlDataSource ID="sdsHero" runat="server" ConnectionString="&lt;%$ ConnectionStrings:SiteSqlServer2 %&gt;" 
      SelectCommand="SELECT [num], [HeroName] FROM [Super_Heros]"&gt;&lt;/asp:SqlDataSource&gt;
  &lt;asp:SqlDataSource ID="sdsAbility" runat="server" ConnectionString="&lt;%$ ConnectionStrings:SiteSqlServer2 %&gt;" 
      SelectCommand="SELECT [num], [AbilityName] FROM [Super_Ability]"&gt;&lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>And in my code behind I have:</p>
  
  <pre><code>protected void rptHero_ItemDataBound(object sender, RepeaterItemEventArgs e)
  {
      if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
      {
          DataRowView row = (DataRowView)e.Item.DataItem;
  
          Repeater nestedRepeater = e.Item.FindControl("rptAbility") as Repeater;
          nestedRepeater.DataSource = sdsAbility;
          nestedRepeater.DataBind();
      }
  }
  </code></pre>
  
  <p>Following <a href="https://stackoverflow.com/questions/3356229/nested-repeater">Example 1</a> and <a href="https://stackoverflow.com/questions/2923137/repeater-in-repeater">Example 2</a> posted by our fine patrons here on Stack Overflow this should work however, I think the part I am skipping over where the <code>[num]</code> of the parent repeater gets compared to the <code>[HeroID]</code> of the child repeater as in a SQLJoin.</p>