1
Answer

Rad:Treelist CheckBox Issue

Hi,

I have a Rad:TreeList. In my treelist when Parent Item is checked, all childs
items under that parent item should get checked automatically.
I am able to achieve this if i use TreeListSelectColum by writing the below
code.

<telerik:RadTreeList ID="radTreelistLocation" runat="server" OnItemDataBound="radTreelistLocation_ItemDataBound"
AutoGenerateColumns="false"
ParentDataKeyNames
="ParentLocationId" AllowMultiItemSelection="true"
ShowTreeLines="true" OnNeedDataSource="RadTreeList1_NeedDataSource" AllowPaging="true" PageSize="50" DataKeyNames="ID" AllowSorting="true">

<ClientSettings Selecting-AllowItemSelection="true"></ClientSettings>

<Columns>

<telerik:TreeListSelectColumn UniqueName="SelectColumn" HeaderText= "Assign">

</telerik:TreeListSelectColumn>

<telerik:TreeListTemplateColumn UniqueName="locationName" HeaderText="Location
Name">

<ItemTemplate>

<asp:Label ID="lblLocationName" runat="server" Text='<%#Eval("Name") %>' />

</ItemTemplate>

</telerik:TreeListTemplateColumn>

</Columns>

</telerik:RadTreeList>

<
script type="text/jscript">

function itemSelected(sender, args) {

var treelist = sender;

var selectedItem = args.get_item();

// if (selectedItem.get_parentItem())

// treelist.selectItem(selectedItem.get_parentItem());

selectChildren(selectedItem);

function selectChildren(item) {

treelist.selectItem(item);

if (item.get_childItems().length > 0) {



for (var i = 0; i < item.get_childItems().length; i++) {



selectChildren(item.get_childItems()[i]);



}



}



}



}</script>



But i am
using a checkBox colum. When i check a parent item all child items under that
parent should be checked.

Below is my code.



<Telerik:TreeListTemplateColumn UniqueName="locationName" HeaderText="Location Name">



<ItemTemplate>

<
asp:CheckBox ID="chkAssign" runat="server" Checked='<%#
Eval("IsChecked") %>'
OnCheckedChanged="chkAssign_CheckChanged"/>



</ItemTemplate>



</telerik:TreeListTemplateColumn>



Please help me to achieve this.



 



 



 



Answers (1)
Next Recommended Forum