title: Repeater, datatable and checkbox enable/disable
body: <p>I have an asp Repeater and its DataSource is a DataTable (with data from database).
  On the first loading of the page, the DataTable is filled from the db and then its datas are binded to the Repeater.
  Then I put the DataTable into the ViewState and on postback I use the DataTable from the ViewState, then it enables me to inject datas in database only after everything has been completed by the user.</p>
  
  <p>Some lines can be added to the Repeater (by adding to the viewstate's DataTable and re-bind).</p>
  
  <p>Here is the Repeater's code : </p>
  
  <pre><code>  &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
      &lt;ContentTemplate&gt;
          &lt;asp:HiddenField ID="HdfHiddenRow" ClientIDMode="Static" runat="server" /&gt;
          &lt;asp:HiddenField ID="HdfHiddenId" ClientIDMode="Static" runat="server" /&gt;
          &lt;div style="display:none;"&gt;
              &lt;asp:Button ID="BtnHiddenButton" runat="server" Text="" OnClick="BtnHiddenButton_Click" /&gt;
          &lt;/div&gt;
          &lt;table id="TableEI" style="width: 800px; margin-left:50px;" cellpadding="0" cellspacing="0"&gt;
              &lt;asp:Repeater ID="Repeat_EffetsIndes" runat="server" OnItemDataBound="Repeat_EffetsIndes_ItemDataBound" &gt;
                  &lt;ItemTemplate&gt;
                      &lt;tr&gt;
                          &lt;td style="width: 431px;"&gt;
                              &lt;asp:Label ID="LblEI" runat="server" /&gt;
                          &lt;/td&gt;
                          &lt;td class="auto-style1"&gt;
                              &lt;asp:CheckBox ID="CheckOui" ClientIDMode="Static" runat="server" Text="Yes" onclick="CheckedLine(this)" /&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;asp:CheckBox ID="CheckOui1" ClientIDMode="Static" runat="server" Enabled="false" Text="some text1" /&gt;   
                              &lt;br /&gt;
                              &lt;asp:CheckBox ID="CheckOui2" ClientIDMode="Static" runat="server" Enabled="false" Text="some text2" /&gt;
                              &lt;br /&gt;
                              &lt;asp:CheckBox ID="CheckOui3" ClientIDMode="Static" runat="server" Enabled="false" Text="some text3" /&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:Repeater&gt;
          &lt;/table&gt;
  .....
  [textbox + button to add new row there]
  .....   
     &lt;/ContentTemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>Check an example of rows from my Repeater :</p>
  
  <p><a href="http://img4.hostingpics.net/pics/356954example.png" rel="nofollow">http://img4.hostingpics.net/pics/356954example.png</a></p>
  
  <p>When the 1st checkbox (Yes) is chcked : it enables the 3 right checkboxes. 
  (this has been done thanks to javascript)</p>
  
  <p>I had to give a unique ID to my 4 checkboxes on each row, and be able to identify which checkboxes have to be enabled when the parent is checked.
  I give a unique ID on ItemDataBound event of Repeater.</p>
  
  <pre><code>protected void Repeat_EffetsIndes_ItemDataBound(object sender, RepeaterItemEventArgs e)
      {
          DataRowView drv = e.Item.DataItem as DataRowView;
          ((Label)e.Item.FindControl("LblEI")).Text = drv["Suivi_EffetsIndes_Label"].ToString();
  
          CheckBox ParentCheckBox = ((CheckBox)e.Item.FindControl("CheckOui"));
          CheckBox ChildCheckBox1 = ((CheckBox)e.Item.FindControl("CheckOui1"));
          CheckBox ChildCheckBox2 = ((CheckBox)e.Item.FindControl("CheckOui2"));
          CheckBox ChildCheckBox3 = ((CheckBox)e.Item.FindControl("CheckOui3"));
  
          string _IdPrefix = Guid.NewGuid().ToString().Replace("-", "");
  
          // Affectation d'un ID unique à chaque checkbox "Oui" 
          ParentCheckBox.ID = _IdPrefix;
          // Concaténation de l'ID de la checkbox parent (Oui) et d'un chiffre pour identifier les checkboxes.
          ChildCheckBox1.ID = _IdPrefix + "1";
          ChildCheckBox2.ID = _IdPrefix + "2";
          ChildCheckBox3.ID = _IdPrefix + "3";
    }
  </code></pre>
  
  <hr>
  
  <p><b>The Problem</b></p>
  
  <p>When one of the 3 right checkboxes is checked, i would like to directly update the correct value in the ViewState datatable (set field "checked" from 0 to 1).</p>
  
  <p>The problem is that I have some trouble to catch the "CheckedChanged" of the checkboxes, don't know why, and also the "ID" of the checkboxes seem to always set to its default value so i can find them by writing "Repeater.Items[x].FindControl("CheckOui1") for example, and it would not have to be possible because I give them a new ID, and that's thanks to this one that i would like to find which checkbox is checked.</p>
  
  <p>(apologies for my not perfect english writing)</p>