title: hide and show dynamically control based on checkbox value in asp.net
body: <p>I want to have a javascript added to a checkbox that is created on the fly. And when this checkbox is toggle I want to hide or show the panels. These panels are also created on the fly.  </p>
  
  <p>There is a loop that put the id of the panel from the loop value</p>
  
  <p>For example,</p>
  
  <pre><code>for (int a; a &lt; mydataset[count]; a++)
    if (mydataset value is Textbox)
      Panel MyPanel = new Panel()
  
  MyPanel.ID=Panel+myDataSet[count];  //so Panel1, or Panel2 based on the count.
  
  if myDataSet.count=4
  {
    Panel3.CssStyle=hidePopup; // I am able to hide the panel at runtime.
  }
  
  if (mydataset value is CheckBox)
    CheckBox myCheckBox=new CheckBox();
  </code></pre>
  
  <p>CheckBox // here I want to add a javascript function.  so when this checkbox is checked/unchecked some of the panel can be hide or show. There are 20 Panel. and instead of making all of them hide or show I need to hide 10 of them.  For example Panel1, Panel4 or Panel10. </p>
  
  <p><code>Panel3.CssStyle=hidePopup</code> works fine with this inline code.</p>
  
  <pre><code>&lt;style type="text/css"&gt;
        .hidePopup
        {
            visibility: hidden;
            display: none;
        }
  
        .showPopUp
        {
            visibility: visible;
            display: block;
        }
  &lt;/style&gt;
  </code></pre>