title: Nested Repeater Puzzle: Using data returned from (outer) query, in a nested query
body: <p>Hope you are having a good start today on any projects you are working on.  I'm starting today with an interesting problem I need to solve involving a Nested repeater in ASP.net (to take in data from an SQL database to build webpage results for grant data related to education and welfare).</p>
  
  <p>I have one repeater which is using an SQL query to pull back data based on a specific column in my SQL table, the Category column:</p>
  
  <pre><code>&lt;asp:SqlDataSource ID="SqlDataSourceGrantCategories" runat="server" 
  ConnectionString="&lt;%$ ConnectionStrings:KenticoCMSECommerceTestingConnectionString %&gt;" 
  SelectCommand="SELECT * FROM [customtable_SampleTable] ORDER BY Category"&gt;
  &lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>Now I would like to have an additional, nested repeater which has another query providing data to it, but this inner repeater bases it's query off of the Category column (from the SQL table) as pulled by the first repeater.  Here is what I have so far:</p>
  
  <pre><code>&lt;asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSourceGrantCategories"&gt;
    &lt;ItemTemplate&gt;
    &lt;%# Eval("Category") %&gt; //I just need this piece of data, but used below.
    &lt;br /&gt;
        &lt;asp:Repeater ID="Repeater2" runat="server" DataSourceID="SqlDataSourceGrantInfo"&gt;
        &lt;asp:SqlDataSource ID="SqlDataSourceGrantInfo" runat="server" ConnectionString="&lt;%$ ConnectionStrings:KenticoCMSECommerceTestingConnectionString %&gt;
      SelectCommand="SELECT * FROM [customtable_SampleTable] WHERE Category = &lt;%# Eval('Category') %&gt;"&gt;
      &lt;ItemTemplate&gt;
      &lt;%# Eval("Title") %&gt;
      &lt;/ItemTemplate&gt;
    &lt;/asp:Repeater&gt;
    &lt;br /&gt;
    &lt;/ItemTemplate&gt;
  &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>So basically, the <strong>Eval statement inside of the second, nested SqlDataSource</strong> is not being evaluated properly, it is giving me an error which says "Server tag not well formed".  Is there any way for me to use or make a variable equal to the first Eval("Category") statement, which I can then use in my second SQL Query string?</p>
  
  <p>Sorry if this is confusing, I'd be happy to elaborate on this further if needed.</p>