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

Declarative Binding and GridCheckBoxColumn

2 Answers 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 06 Jan 2014, 03:05 AM
Hello,
I have implemented the client-side declarative binding sample but can not get the GridCheckBoxColumn to show as checked regardless of the Sql value. I see that the http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/declarative/defaultcs.aspx sample has the same problem. How can I get this to work? I tried implementing RowDataBound but this did not help. Thank you.
function RowDataBound(sender, eventArgs) {
        if (eventArgs.get_dataItem()["Discontinued"] == true) {
            var checkbox = eventArgs.get_item().get_cell("Discontinued").getElementsByTagName("input")[0];
            checkbox.checked = true;
        }
    }

2 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 09 Jan 2014, 08:08 AM
Hi Jeff,

If you change the skin to Office2007 you will noticed that the last item is actually checked. Since the CheckBox controls are formatted by the RadFormDecorator their opacity is reduced.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Jeff
Top achievements
Rank 1
answered on 21 Jan 2014, 03:49 AM
Hello, it turns out all I needed to do was set the disabled property to false and re-check boxes:
function GridRowDataBound(sender, eventArgs) {
    var checkbox = eventArgs.get_item().get_cell("Discontinued").getElementsByTagName("input")[0];
    checkbox.disabled = false;
    checkbox.checked = false;
    if (eventArgs.get_dataItem()["Discontinued"] == true) {
        checkbox.checked = true;
    }
    checkbox.disabled = true;
}

Tags
Grid
Asked by
Jeff
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or