title: Find a checkbox for only certain repeats in a repeater
body: <p>I will try to paraphrase my question and try to code an example but is in asp.net and C#.</p>
  
  <p>I have a repeater that inside in a bunch of checkboxes. The table is laid out similar to this...</p>
  
  <pre><code>&lt;ItemTemplate&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;%#Eval("question")%&gt;&lt;/td&gt;
          &lt;td&gt;&lt;a href="edit.aspx?id=&lt;%#Eval('id')%&gt;"&gt;Edit&lt;/a&gt;&lt;/td&gt;
          &lt;td&gt;Applies to the following&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_A" runat="server" Text="Model A" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_B" runat="server" Text="Model B" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_C" runat="server" Text="Model C" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;ItemTemplate&gt;
  </code></pre>
  
  <p>When it databinds it receives the question, id, and a list of models to be Checked the first time... so</p>
  
  <p>Question 1..(ID)10... A C ...</p>
  
  <p>But how do i get it to check chkModel_A and chkModel_C because they are in the repeater and I can have multiple questions in this table so when it does Question 2 it won't get A C and gets whatever question 2 is.  Currently, it only checks the last or maybe it's the first databinded question.  Thanks for any help!</p>
  
  <p>I forgot to add the databinding...</p>
  
  <pre><code>protected void rptQs_ItemDataBound(object sender, RepeaterItemEventArgs e) {
          RepeaterItem ri = e.Item;
          foreach(string model in modelsSplit) {
              CheckBox cb = (CheckBox) ri.FindControl("chkModel_" + model);
              if (cb != null) {
                  cb.Checked = true;
               }
           }
  }
  </code></pre>
  
  <p>Here is the result after a databind.</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;This is question 1&lt;/td&gt;
          &lt;td&gt;&lt;a href="edit.aspx?id=1"&gt;Edit&lt;/a&gt;&lt;/td&gt;
          &lt;td&gt;Applies to the following&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_A" runat="server" Text="Model A" Checked="true" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_B" runat="server" Text="Model B" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_C" runat="server" Text="Model C" Checked="true" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;This is question 2&lt;/td&gt;
          &lt;td&gt;&lt;a href="edit.aspx?id=2"&gt;Edit&lt;/a&gt;&lt;/td&gt;
          &lt;td&gt;Applies to the following&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_A" runat="server" Text="Model A" Checked="true" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_B" runat="server" Text="Model B" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_C" runat="server" Text="Model C" Checked="true" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;This is question 3&lt;/td&gt;
          &lt;td&gt;&lt;a href="edit.aspx?id=3"&gt;Edit&lt;/a&gt;&lt;/td&gt;
          &lt;td&gt;Applies to the following&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_A" runat="server" Text="Model A" Checked="true" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_B" runat="server" Text="Model B" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;asp:CheckBox id="chkModel_C" runat="server" Text="Model C" Checked="true" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I am trying to get each row in the table to have the correct checkboxes checked.  Instead all of them are checked the same way. I can't get Question 2 or 3 to show properly. Hope that helps explaining.</p>