Child record won't show (when no parent)

2 posts, 0 answers
  1. Greg
    Greg avatar
    5 posts
    Member since:
    Sep 2012

    Posted 28 May 2015 Link to this post


    For security reasons, I do not want to show some of the parent items, but want to show only their children. How can this be achieved?  





  2. Viktor Tachev
    Viktor Tachev avatar
    2156 posts

    Posted 02 Jun 2015 Link to this post

    Hello Greg,

    Note that the RadTreeList control is intended to display hierarchical data. In order for the child records to be displayed there should be a parent item they are related to.

    With this said, you can hide the real content of some fields by handling the ItemDataBound event. In the handler you can specify custom condition. When the condition is met the text in the confidential field would be changed.

    Check out the following code snippet that illustrates the approach.

    protected void RadTreeList1_ItemDataBound(object sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e)
        if (e.Item is TreeListDataItem)
            TreeListDataItem dataItem = e.Item as TreeListDataItem;
            // add custom condition here
            if (dataItem.ParentItem == null && dataItem["ID"].Text == "5")
                // hide contents of ConfidentialData column
                dataItem["ConfidentialData"].Text = "hidden content";

    Viktor Tachev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top