title: How to access Parent repeater id from code behind
body: <p>I have a nested repeater on my page like:</p>
  <p><img src="https://i.stack.imgur.com/fkUfo.jpg" alt="enter image description here" /></p>
  <p>Aspx page:</p>
  <pre><code>    &lt;asp:Repeater ID=&quot;parentRepeater&quot; runat=&quot;server&quot;&gt;
          &lt;ItemTemplate&gt;
              &lt;br /&gt;
              &lt;b&gt;&lt;%# DataBinder.Eval(Container.DataItem,&quot;question&quot;) %&gt;&lt;/b&gt;&lt;br&gt;
  
              &lt;!-- start child repeater --&gt;
              &lt;asp:Repeater ID=&quot;childRepeater&quot; DataSource='&lt;%# ((DataRowView)Container.DataItem).Row.GetChildRows(&quot;relation&quot;) %&gt;'
                  runat=&quot;server&quot;&gt;
  
                  &lt;ItemTemplate&gt;
                      &lt;asp:LinkButton ID=&quot;LinkButton1&quot; runat=&quot;server&quot; OnCommand=&quot;LinkButton1_Command&quot; CommandName=&quot;MyUpdate&quot; CommandArgument='&lt;%# DataBinder.Eval(Container.DataItem, &quot;[\&quot;AnsId\&quot;]&quot;)%&gt;'&gt;&lt;%# DataBinder.Eval(Container.DataItem, &quot;[\&quot;Ans\&quot;]&quot;)%&gt;&lt;/asp:LinkButton&gt;
  
                      &lt;br&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:Repeater&gt;
              &lt;!-- end child repeater --&gt;
  
          &lt;/ItemTemplate&gt;
      &lt;/asp:Repeater&gt;
  </code></pre>
  <p>Code behind:</p>
  <pre><code>SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings[&quot;star_report_con&quot;].ConnectionString);
  SqlDataAdapter cmd1 = new SqlDataAdapter(&quot;select questionId, question from questions&quot;, cnn);
  
  //Create and fill the DataSet.
  DataSet ds = new DataSet();
  cmd1.Fill(ds, &quot;questions&quot;);
  
  //Create a second DataAdapter for the Titles table.
  SqlDataAdapter cmd2 = new SqlDataAdapter(&quot;SELECT AnsId, Ans, questionId FROM answers&quot;, cnn);
  cmd2.Fill(ds, &quot;answers&quot;);
  
  //Create the relation bewtween the Authors and Titles tables.
  ds.Relations.Add(&quot;relation&quot;,
  ds.Tables[&quot;questions&quot;].Columns[&quot;questionId&quot;],
  ds.Tables[&quot;answers&quot;].Columns[&quot;questionId&quot;]);
  
  //Bind the Authors table to the parent Repeater control, and call DataBind.
  parentRepeater.DataSource = ds.Tables[&quot;questions&quot;];
  Page.DataBind();
  
  //Close the connection.
  cnn.Close();
  
  protected void LinkButton1_Command(object sender, CommandEventArgs e)
  {
      if (e.CommandName == &quot;MyUpdate&quot;)
      {
          
          //e.CommandArgument --&gt; contain the Ansid value
          //I want to also find which questions ans is clicked i.e the questionId
      }
  }
  </code></pre>
  <p>In my child repeater I have a linkbutton on click of which i need to do some computaion for which I need to know which questions answers wa being clicked. i.e in my  <code>LinkButton1_Command</code> I want to fetch the AnsId along with QuestionId.</p>
  <p>How will I get parent repeaters Id in button click event?</p>