How to check all check boxes in Telerik Kendo Grid
<p>I have a Kendo Grid with check box column. I want to check all check boxes in the grid and keep it across the pages. I have a method CheckAll(), but it checks only the first page of Kendo Grid. How to check all check boxes by one click on the link or button? My code is here:</p>

<pre><code>&lt;div style="text-align:right; font-size: 0.9em;height:28px;position: relative;"&gt;

        &lt;span style="float:left;text-align:left;"&gt;
            &lt;a href="#" onclick="checkAll();"&gt;Check All&lt;/a&gt;&amp;nbsp;
            &lt;a href="#" onclick="uncheckAll();"&gt;Uncheck All&lt;/a&gt;&amp;nbsp;
            &lt;a class="k-button k-button-icontext k-grid-Patient" id="hrefCheckedPatients" href="#" onclick="getChecked();"&gt;Export to PDF&lt;/a&gt;&amp;nbsp;
            &lt;a href="#" id="lnkPdfDownload" style="display:none;" onclick="$(this).hide();"&gt;Download Generated PDF&lt;/a&gt;
            &lt;label id="checkedMsg" style="color:red;display:none;"&gt;&lt;/label&gt;
        &lt;/span&gt;

    &lt;/div&gt;
 @(Html.Kendo().Grid&lt;RunSummary&gt;()
          .Name("CheckedPatients")          
          .DataSource(datasource =&gt; datasource
                .Ajax().PageSize(25)        
                .Sort(sort =&gt; sort.Add("UniqueId").Ascending())                        
                .Read(read =&gt; read.Action("GetRunSummaries", "PatientReport")))
          .Columns(columns =&gt;
              {

                  columns.Bound(c =&gt; c.UniqueId).Title(ELSORegistry.Resources.Views.Home.HomeStrings.UniqueId)
                        .ClientTemplate("&lt;input type='checkbox'  class='primaryBox' id='#= UniqueId #'&gt;#= UniqueId #&lt;/input&gt;");
                  columns.Bound(c =&gt; c.RunNo).Title(SharedStrings.Run);
                  columns.Bound(c =&gt; c.Birthdate).Title(SharedStrings.Birthdate).Format("{0:g}").Filterable(true);

                  columns.Bound(c =&gt; c.customAge).Title(SharedStrings.Age)
                         .Filterable(
                             filterable =&gt; filterable
                                 .UI("AgeFilter")
                                 .Extra(false)
                                 .Operators(operators =&gt; operators
                                     .ForString(str =&gt; str.Clear().IsEqualTo("Is equal to"))
                                     )

                       );

                  columns.Bound(c =&gt; c.TimeOn).Title(PatientStrings.DateOn)
                      .Format("{0:g}")
                      .Filterable(true);
                  columns.Bound(c =&gt; c.TimeOff).Title(PatientStrings.DateOff)
                      .Format("{0:g}")
                      .Filterable(true);
                  columns.Bound(c =&gt; c.DischargedAlive).Title(PatientStrings.DischargedAlive).Filterable(true).ClientTemplate("#= DischargedAlive ? 'Yes' : 'No' #");
                  columns.Bound(c =&gt; c.ShowSubmitted).Title(PatientStrings.Submitted).Filterable(true).ClientTemplate("#= ShowSubmitted ? 'Yes' : 'No' #");
                  columns.Bound(c =&gt; c.SupportTypeEnum).Title(PatientStrings.SupportType).Filterable(true);//.ClientTemplate("#= SupportType ? 'Yes' : 'No' #");
              }
          )
          .Pageable(p =&gt; p.PageSizes(new[] {10, 25, 50, 100}))
          .Sortable()
          .Filterable( )
          .Events( e =&gt; e.FilterMenuInit("FilterMenuFuncWithAge") ) // apply x [closing box] on pop up filter box
          )
&lt;script type="text/javascript"&gt; 


    function checkAll() {
        $('input').prop('checked', 'checked');
    }

    function uncheckAll() {
        $('input').removeAttr('checked');
    }
&lt;/script&gt;
</code></pre>