Telerik MVC Grid (NOT KENDO) - How to toggle all check boxes?

4 posts, 0 answers
  1. Fabio
    Fabio avatar
    5 posts
    Member since:
    Oct 2012

    Posted 09 Sep 2014 Link to this post

    How do I turn on/off all check boxes in a Telerik Grid?

    I have a grid with 3 columns (Name, IsActive, IsDefault) -
    The IsActive and IsDefault rows have a check box in them.

    My Header column for both IsActive and IsDefault have a HeaderTemplate with a check box.
    I want to be able to check/uncheck the header check box and have that chance propagate to all check boxes below.

    I am also using batch edit - So I'll check batch edit first, check/uncheck all and click save

    Screen shot:

  2. Alexander Popov
    Alexander Popov avatar
    1434 posts

    Posted 12 Sep 2014 Link to this post

    Hello Fabio,

    This could be achieved by subscribing to the click event of the checkbox in the header and once it is triggered - iterate over the Grid's rows, pass them to the dataItem method and modify the values accordingly.
    Also please note that as of June 2013, Telerik Extensions for ASP.NET MVC has reached its official End of Life, with no additional fixes or enhancements expected in the future. I would strongly recommend to upgrade to Telerik UI for ASP.NET MVC as we no longer provide support for the Telerik Extensions.

    Alexander Popov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. Fabio
    Fabio avatar
    5 posts
    Member since:
    Oct 2012

    Posted 12 Sep 2014 in reply to Alexander Popov Link to this post

    Our product has been out for 4 years and it is deeply embedded with Telerik controls.  We have so much logic in the client controls that unfortunately upgrading to Kendo UI is not feasible at the moment.   I wish I could run it side by side with Telerik, but there seems to be a problem with the Jquery version, but anyways.

    Thank you for the reply.  I have one more question to you.
    I am trying to get a hold of all rows but when I call "" I always get null - Can you tell me what is wrong?

    Here is the sample code:

    01.@using Telerik.Web.Mvc.UI
    02.@model List<TelerikTest.Controllers.Foo>
    05.      .Name("FooGrid")
    06.      .TableHtmlAttributes(new {@style = "width:500px;"})
    07.      .HtmlAttributes(new {@style = "width:500px;"})
    08.      .DataBinding(builder => builder.Server())
    09..Columns(c =>
    10.    {
    11.        c.Bound(model => model.Name);
    12.        c.Bound(model => model.IsActive).HeaderTemplate("<input type=\"checkbox\" name=\"IsActiveHeader\" checked onchange=\"ToggleActiveChkBoxes(this)\"/><div>Active</div>");
    13.        c.Bound(model => model.IsDefault).HeaderTemplate("<input type=\"checkbox\" name=\"IsActiveHeader\" checked onchange=\"ToggleDefaultChkBoxes(this)\"/><div>Default</div>");
    14.    }))
    16.<script type="text/javascript">
    18.    function ToggleActiveChkBoxes(e) {
    19.        //Get the grid data
    20.        var grid = $('#FooGrid').data('tGrid');
    21.        var data =;
    23.        if (data != null) {
    24.            var rowCount = data.length;
    25.            for (var i = 0; i < rowCount; i++) {
    26.                var myRow = data[i].RowData;
    27.                ToggleCheckBox(myRow, e.checked);
    28.            }
    29.        }
    30.    }

  4. Dimo
    Dimo avatar
    8404 posts

    Posted 15 Sep 2014 Link to this post

    Hello Fabio,

    The data property of the discontinued MVC Grid object works only with client-side binding as stated in its documentation -

    We have provided some hints on your legacy application in this thread as an exception, but I am afraid we will not be able to do so anymore for the following reasons:

    + the Telerik Extensions for ASP.NET MVC no longer exist as a product and are officially no longer supported. This was announced in 2012 and there was a one-year maintenance and transition phase.

    + your account is currently not associated with any commercial license that could grant you the ability to benefit from our technical support service for production applications. You have an active trial for Kendo UI MVC, however, trials are intended for the sole purpose of evaluating a product before purchasing. Working on an existing production application cannot qualify as evaluation.

    Theoretically, it is possible to use a new jQuery version with old Javascript code, which normally requires an old jQuery version. In this way you will be able to start migrating the Telerik MVC Extensions to Kendo UI MVC, and/or use them side-by-side.

    Again, since this is a production application, you will need to purchase a commercial license before starting the integration process, in order to comply with our EULA.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top