title: Check all CheckBoxes in Telerik RadGrid
body: <p>I copied the code from the below link
  <a href="https://stackoverflow.com/questions/12685944/check-all-checkboxes-in-telerik-nested-grid-in-c-sharp/13883592#13883592">Check all CheckBoxes in Telerik nested Grid in C#</a></p>
  
  <p>How ever when I run the code I get this error:</p>
  
  <p><code>0x800a01b6 - Microsoft JScript runtime error: Object doesn't support this property or method</code></p>
  
  <p>and the <code>'checkAll(this, gridToCheckAll);'</code> is highlighted in the dynamic run code with the error.</p>
  
  <p>Any help would be appreciated.</p>
  
  <pre><code>&lt;script&gt;
  var gridToCheckAll = '&lt;%= rgFiles.ClientID %&gt;';
  
      function checkAll(sender, containerID) {
          var checked = sender.checked;
          var container = document.getElementById(containerID);
          var checkboxes = container.getElementsByTagName('input');
          for (var i = 0, l = checkboxes.length; i &lt; l; i++) {
              if (checkboxes[i] != sender &amp;&amp; !checkboxes[i].disabled)
                  checkboxes[i].checked = checked;
          }
      }
  &lt;/script&gt;
  
  &lt;telerik:RadGrid id="rgFiles" runat="server" HorizontalAlign="NotSet" BackColor="darkgray"
      AllowPaging="True" PageSize="50" AllowSorting="True"
      EnableEmbeddedScripts="true" 
      OnNeedDataSource="rgFiles_NeedDataSource"  
      OnItemCommand="rgFiles_ItemCommand" 
      OnItemDataBound="rgFiles_ItemDataBound" 
      OnItemEvent="rgFiles_ItemEvent"
      AllowMultiRowSelection="true" Skin="" 
      AllowFilteringByColumn="true" EnableLinqExpressions="false" &gt;
      &lt;MasterTableView  HorizontalAlign="NotSet" AutoGenerateColumns="false" AllowSorting="True"
          Font-Size="7pt" AllowCustomSorting="true" CellPadding="2" CellSpacing="1" BorderWidth="0px"
          TableLayout="Fixed" AlternatingItemStyle-Wrap="false" ItemStyle-Wrap="false" 
          CommandItemStyle-Wrap="false" &gt;
          &lt;FooterStyle CssClass="datagrid-footerstyle" HorizontalAlign="Right" /&gt;
          &lt;ItemStyle CssClass="datagrid-itemstyle" Wrap="false" Font-Size="XX-Small" Height="15px"/&gt;
          &lt;EditItemStyle BackColor="#2461BF" /&gt;
          &lt;PagerStyle BackColor="#E0E0E0" ForeColor="DimGray" HorizontalAlign="Left" Mode="NextPrevAndNumeric"
              NextPageText="next" PrevPageText="prev" AlwaysVisible="True" /&gt;
          &lt;HeaderStyle CssClass="datagrid-headerstyle" ForeColor="White" /&gt;
          &lt;FilterItemStyle BackColor="#a9a9a9" /&gt;
          &lt;AlternatingItemStyle CssClass="datagrid-alternatingitemstyle" /&gt;
          &lt;ExpandCollapseColumn Visible="False"&gt;
              &lt;HeaderStyle Width="19px" /&gt;
          &lt;/ExpandCollapseColumn&gt;
          &lt;RowIndicatorColumn Visible="False"&gt;
              &lt;HeaderStyle Width="20px" /&gt;
          &lt;/RowIndicatorColumn&gt;
          &lt;Columns&gt;
              &lt;telerik:GridTemplateColumn SortExpression="Reviewed"  DataField="Reviewed" HeaderText="&lt;input type='checkbox' id='checkAll' onclick='checkAll(this, gridToCheckAll);'&gt;" 
                  UniqueName="Reviewed" AllowFiltering="false" &gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:CheckBox ID="cbReviewed" runat="server" OnCheckedChanged="cbReviewed_CheckedChanged" /&gt;
                  &lt;/ItemTemplate&gt;
                  &lt;ItemStyle Wrap="False" HorizontalAlign="Center" VerticalAlign="Top"&gt;&lt;/ItemStyle&gt;
                  &lt;HeaderStyle Width="50px"&gt;&lt;/HeaderStyle&gt;
              &lt;/telerik:GridTemplateColumn&gt;
  </code></pre>