This is a migrated thread and some comments may be shown as answers.

RadGrid GridClientSelectColumn disable checkbox in certain rows

6 Answers 1256 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chen Jun Ying
Top achievements
Rank 1
Chen Jun Ying asked on 14 Feb 2012, 02:21 PM
Hi all,

How to disable GridClientSelectColumn checkbox in some of the rows? Which grid event shall I look into? How can I reference to the checkbox?

Thanks
Chen.

6 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 14 Feb 2012, 06:32 PM
Hello Chen,

I hope the following code library will help you for your implementation:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/disable-selection-for-some-rows-in-gridclientselectcolumn-conditionally.aspx

Kind regards,
Pavlina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Chen Jun Ying
Top achievements
Rank 1
answered on 15 Feb 2012, 10:35 AM
Thanks Pavlina.

Just further our discussion.. Is it possible to make the select/unselect all checkbox work in the header? The solution you provided breaks the unselect all function. I believe GridClientSelectColumn still count those disabled rows.
0
Pavlina
Telerik team
answered on 15 Feb 2012, 12:41 PM
Hello Chen,

Can you please specify which version of RadControls you are using?

Kind regards,
Pavlina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Chen Jun Ying
Top achievements
Rank 1
answered on 15 Feb 2012, 01:50 PM
0
Fernando
Top achievements
Rank 2
answered on 08 Dec 2016, 12:07 PM

It is so much easier to use dataItem.SelectableMode = GridItemSelectableMode.None; in the OnItemCreated event

 

protected void OnItemCreated(object seneder, GridItemEventArgs e)
{
    try
    {
        if (e.Item is GridDataItem && e.Item.DataItem != null)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            DocumentInfo revisao = (DocumentInfo)e.Item.DataItem;
            // Condition to desable the row
            if (revisao.id_revisao.Equals(2)))
            {
                CheckBox checkBox = (CheckBox)dataItem["ClientSelectColumn"].Controls[0];
                checkBox.Enabled = false;
                dataItem.ForeColor = Color.Gray;
                 
                // here we disable the row
                dataItem.SelectableMode = GridItemSelectableMode.None;
            }
        }
    }
    catch { }
}
0
Richa Chauhan
Top achievements
Rank 1
answered on 04 Mar 2020, 06:24 PM
This was very useful !
Tags
Grid
Asked by
Chen Jun Ying
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Chen Jun Ying
Top achievements
Rank 1
Fernando
Top achievements
Rank 2
Richa Chauhan
Top achievements
Rank 1
Share this question
or