title: c# repeater: I get one value from an indexed control in code behind but can't get others... why?
body: <p>I'm using a repeater with a DbDataReader which displays all data correctly in the .aspx.  I want to access specific columns and rows int the repeater in the code behind.  I can get only one but not the others and I can't figure out why.  Here is a shortened sql statement that I'm using:</p>
  
  <pre><code>sql = "select distinct question_explain_int as competency_int,dbo.CodeDescription('competency', question_explain_int, 0) as competency";
  sql += " from test_content tc left join test_question tq on tc.question_int = tq.question_int where dbo.CodeDescription('competency', question_explain_int, 0) &lt;&gt; ''";
     DbDataReader rs = CADEdata.ReadData(cnxn, sql);
     competencyRepeater.DataSource = rs;
     competencyRepeater.DataBind();
  </code></pre>
  
  <p>So, I can get competency with:</p>
  
  <pre><code>((Label)competencyRepeater.Items[0].FindControl("competency")).Text    
  ((Label)competencyRepeater.Items[1].FindControl("competency")).Text
  </code></pre>
  
  <p>But the following returns null!  </p>
  
  <pre><code>((Label)competencyRepeater.Items[0].FindControl("competency_int")).Text    
  ((Label)competencyRepeater.Items[1].FindControl("competency_int")).Text
  </code></pre>
  
  <p>Actually, I have a lot more columns and they all return null except the one.  What's going on and how can I get the other values?</p>
  
  <p>EDIT #1:
  I thought I found the solution, competency_int is a hidden field in the .aspx so I switched to the following format but it is still null:</p>
  
  <pre><code>&lt;input type="hidden" name="competency_int" id="competency_int&lt;%#Container.ItemIndex%&gt;" value="&lt;%# Eval("competency_int") %&gt;" /&gt;
  </code></pre>
  
  <p>...</p>
  
  <pre><code>   ((HiddenField)competencyRepeater.Items[1].FindControl("competency_int")).Value
  </code></pre>