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

Child record won't show (when no parent)

1 Answer 51 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 28 May 2015, 04:19 PM

Hello,

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?  

Thanks

 

 

 

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 02 Jun 2015, 09:47 AM
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";
        }
    }
}


Regards,
Viktor Tachev
Telerik
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
Tags
TreeList
Asked by
Greg
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or