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

TreeList checkbox checking issue

1 Answer 105 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Susi
Top achievements
Rank 1
Susi asked on 28 Jun 2012, 05:03 AM
Dear All,

 We are developing project using asp.net with c sharp  and I have TreeList in my page with checkbox but when i select parent checkbox child checkbox not checked what i need to do solve this..
my aspx code is
                               <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">
    <Columns>
        <telerik:TreeListTemplateColumn UniqueName="locationName" HeaderText="Location Name">
            <ItemTemplate>
                <asp:CheckBox ID="chkAssign" runat="server" Checked='<%# Eval("IsChecked") %>' OnCheckedChanged="chkAssign_CheckChanged" />
            </ItemTemplate>
        </telerik:TreeListTemplateColumn>
        <telerik:TreeListTemplateColumn UniqueName="locationName" HeaderText="Location Name">
            <ItemTemplate>
                <asp:Label ID="lblLocationName" runat="server" Text='<%#Eval("Name") %>' />
            </ItemTemplate>
        </telerik:TreeListTemplateColumn>
   </Columns>
</telerik:RadTreeList>
And My aspx.cs page code is.
        protected void Page_Load(object sender, EventArgs e)
        {
             
            if (!Page.IsPostBack)
            {
                PopulateUsers();
                radTreelistLocation.ExpandAllItems();
                bindGrid();
            }
        }
        protected void RadTreeList1_NeedDataSource(object sender, EventArgs e)
        {
            radTreelistLocation.DataSource = _applicationProcess.SelectLocations();
        }
        public void bindGrid()
        {
            List<Location> locationlist = new List<Location>();
            locationlist = _applicationProcess.SelectLocations();
            radTreelistLocation.DataSource = _applicationProcess.SelectLocations();
            radTreelistLocation.DataBind();
            ViewState["location"] = locationlist;
        }
}

Thanks in Advance..!

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 02 Jul 2012, 02:42 PM
Hi Susi,

You would need to enable server-side recursive selection in order to select all children when a parent item is selected. Set AllowRecursiveSelection="true" for the RadTreeList control, and also AllowMultiItemSelection="true". 

You can see how this works in the first RadTreeList in this demo (use the configurator to enable recursive selection):
http://demos.telerik.com/aspnet-ajax/treelist/examples/selecting/serversideselection/defaultcs.aspx 

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
Susi
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or