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

Prevent selection of disabled dataitems when using "check all" checkbox in header

1 Answer 46 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Grumpwurst
Top achievements
Rank 1
Grumpwurst asked on 23 Aug 2012, 10:09 PM
I have a situation where I need to only allow the selection of items in a RadTreeList that the user is authorized to select.  I looped through the data and disabled all the dataitems that the user wasn't authorized to access and I thought everything was working fine until I clicked the checkbox in the header that is used to select all items.

Apparently, it's still marking all the "rows" as selected even though they are disabled.  I'm pretty sure this checkbox is javascript driven and I was able to capture the click via one of the client-side events, but I cannot find documented anywhere a javascript method/property that will allow me to determine if the item is enabled or not.  That way, I could just undo the selection.

This was fairly straightforward with a treeview control (which I cannot use for this particular data) because it had properties (eg get_enabled) that was accessible for that control, but doesn't appear to be available for RadTreeList

Any suggestions?  I need a solution quick because this is being raised as a stop-ship defect

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 28 Aug 2012, 02:44 PM
Hello,

You can handle the OnItemSelecting client event of RadTreeList and check there whether the elements in the TreeListDataItem are disabled. If so, cancel the selection. The mothod and its event args are documented here:
http://www.telerik.com/help/aspnet-ajax/treelist-onitemselecting.html

Regards,
Tsvetina
the Telerik team
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 their blog feed now.
Tags
TreeList
Asked by
Grumpwurst
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or