Enable button if any GridClientSelectColumn is checked in a RadGrid

2 posts, 0 answers
  1. Ingemar
    Ingemar avatar
    10 posts
    Member since:
    Apr 2012

    Posted 03 Oct Link to this post

    I have a RadGrid and a button.

    In the RadGrid, one column is a GridClientSelectColumn.

    I have tried to have a javascript function to enable/disable the button depending on whether one or more rows are selected.

    It will however fail to find the button, because $find will return null. Why?


    <telerik:RadGrid ID="grdActivitiesToCopy" Skin="Metro" AutoGenerateColumns="False"
            AllowMultiRowSelection="True" runat="server">
            <MasterTableView DataKeyNames="id" ClientDataKeyNames="id">
                            <telerik:GridClientSelectColumn UniqueName="DetailCheckColumn" />
                    <Selecting AllowRowSelect="true" />
                    <ClientEvents OnGridCreated="on_grid_created()"></ClientEvents>
    <div style="padding-top: 14px">
            <telerik:RadButton Text="Copy" ID="btnCopy" runat="server"/>


    var btnCopyId = "<%=btnCopy.ClientID %>";
    function on_grid_created()
      $(":checkbox").on('change', function ()
      function update()
        var enabled = $(":checkbox:checked").length > 0;




  2. Viktor Tachev
    Viktor Tachev avatar
    1448 posts

    Posted 05 Oct Link to this post


    Please do not use parenthesis where the handler for the GridCreated event is defined. Also, the Button may not be fully rendered when the Grid is created and this would cause an error.

    Try to modify the code as illustrated below and let me know how it works for you.


        <Selecting AllowRowSelect="true" />
        <ClientEvents OnGridCreated="on_grid_created"></ClientEvents>


    var btnCopyId = "<%=btnCopy.ClientID %>";
    $(document).ready(function () {
    function on_grid_created() {
        $(":checkbox").on('change', update);
    function update() {
        var enabled = $(":checkbox:checked").length > 0;

    Viktor Tachev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft R3 2016 release webinar banner
Back to Top