title: JQuery highlight row with checkbox click
body: <pre><code>$(document).ready(function(){
      $(".txtDate").datepicker({ showOn: "both", 
          buttonImage: "library/ui/datepicker/img/calendar2.gif", dateFormat: "yy/mm/dd", buttonImageOnly: true });
  
      //added this checkbox click for something I given earlier
  
      $("#Table input").click(function() { 
          if ($(this).attr("checked") == true)
          {
              $(this).parent().parent().addClass("highlight");  
          } 
          else
          {   
              $(this).parent().parent().removeClass("highlight");
          }
      });
  });
  </code></pre>
  
  <p>I have a checkbox control for each row that I add dynamically in code behind</p>
  
  <pre><code>for( int i=0; i&lt; data.count;i++){   
      HtmlTableCell CheckCell = new HtmlTableCell();
      CheckBox Check = new CheckBox(); 
  
      CheckCell.Controls.Add(Check);
  
      row.Cells.Add(CheckCell);
      Table.Rows.Add(row);
  }
  </code></pre>
  
  <p>table id with markup is here:</p>
  
  <pre><code>&lt;table id="Table"  runat="server" width="100%" cellspacing="5" border="1"&gt; 
      &lt;colgroup width="3%"&gt;&lt;/colgroup&gt;
      &lt;colgroup width="15%"&gt;&lt;/colgroup&gt;
      &lt;colgroup width="20%"&gt;&lt;/colgroup&gt;
      &lt;colgroup width="15%"&gt;&lt;/colgroup&gt;
      &lt;colgroup width="47%"&gt;&lt;/colgroup&gt;
      &lt;thead&gt;
          &lt;tr&gt; 
              &lt;th id="CheckBox" runat="server"&gt;&lt;input type="checkbox" id="CheckBox1" name="CheckBox" runat="server" /&gt;&lt;/th&gt;
              &lt;th id="Type" runat="server"&gt;&lt;/th&gt;
              &lt;th id="Category" runat="server"&gt;&lt;/th&gt;  
              &lt;th id="DateTime" runat="server"&gt;&lt;/th&gt;  
              &lt;th id="Description" runat="server"&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt; 
      &lt;tbody&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>