In some rows of the grid I need the CHECKBOX to be visible and enabled. How do I do that?
I attach an image.
Best regards.
1 Answer, 1 is accepted
0
Nadya | Tech Support Engineer
Telerik team
answered on 12 Nov 2020, 11:46 AM
Hello, Eusebio,
I suppose that you are using GridViewCheckBoxColumn in the grid. By default, the checkboxes are always visible. If you want to have checkboxes visible only for specific rows, you should handle the CellFormatting event and manage RadCheckBoxEditorElement's Visibility property:
privatevoidRadGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
GridCheckBoxCellElement cell = e.CellElement as GridCheckBoxCellElement;
if (cell != null)
{
RadCheckBoxEditorElement editorElement = (cell.Editor as RadCheckBoxEditor).EditorElement as RadCheckBoxEditorElement;
if (e.RowIndex == 0 || e.RowIndex == 1)
{
editorElement.Visibility = ElementVisibility.Visible;
}
else
{
editorElement.Visibility = ElementVisibility.Hidden;
}
}
}
I hope this helps. Should you have further questions please let me know.
Regards,
Nadya
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.