Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
60 views

Hi,

I'm trying to use the Treelist for a data source with the following definition

public class MyGridItem
{
	public string ID { get; set; }
	public string Name { get; set; }
	public string ParentID { get; set; }
	public bool IsIncluded { get; set; }
	public bool IsExcluded { get; set; }
}

In markup I've got


<telerik:RadTreeList ID="RadTreeMarkers" runat="server" ParentDataKeyNames="ParentID" DataKeyNames="ID" AutoGenerateColumns="false"
	OnNeedDataSource="RadTreeMarkers_NeedDataSource" AllowMultiItemEdit="true" ExpandCollapseMode="Client" EditMode="InPlace"
	AllowPaging="false" AllowSorting="false" OnItemDataBound="RadTreeMarkers_ItemDataBound">
	<Columns>
		<telerik:TreeListBoundColumn DataField="ID" UniqueName="ID" Visible="false" ForceExtractValue="Always"></telerik:TreeListBoundColumn>
		<telerik:TreeListBoundColumn DataField="ParentID" UniqueName="ParentID" Visible="false"></telerik:TreeListBoundColumn>
		<telerik:TreeListBoundColumn DataField="Name" UniqueName="Name" HeaderText="Mark" ReadOnly="true"></telerik:TreeListBoundColumn>
		<telerik:TreeListCheckBoxColumn DataField="IsIncluded" UniqueName="IsIncluded" HeaderText="Included" ForceExtractValue="Always"></telerik:TreeListCheckBoxColumn>
		<telerik:TreeListCheckBoxColumn DataField="IsExcluded" UniqueName="IsExcluded" HeaderText="Excluded" ForceExtractValue="Always"></telerik:TreeListCheckBoxColumn>
	</Columns>
</telerik:RadTreeList>

And then in the code behind I've got
protected void RadTreeMarkers_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
{
	var treeData = MyFacade.GetTreeData();
	var treeDataGridItems = treeData.Select(m => new GridItem
	{
		ID = m.ID.ToString(),
		Name = m.Name,
		ParentID = m.ParentID.HasValue ? m.ParentID.Value.ToString() : string.Empty,
		IsIncluded = m.IsIncluded.HasValue && m.IsIncluded == true,
		IsExcluded = m.IsIncluded.HasValue && m.IsIncluded == false
	}
	).ToList();
	RadTreeMarkers.DataSource = treeDataGridItems;
}

protected void RadTreeMarkers_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e)
{
	if (e.Item is TreeListDataItem item)
	{
		item.Edit = true;
	}
}

The intention is for (only) the two checkboxes to be always editable in the client.

However, when rendered in the client the root items are editable but none of the child items is editable.

What am I doing wrong?

Doncho
Telerik team
 answered on 05 Apr 2023
1 answer
56 views
I have a RadTreeList that is bound to a very large amount of data (100,000 + rows of data). The user is searching and is only interested in only part of the data, perhaps 20-30 rows anywhere in the data bound to the control. These rows will most likely be between child/parents within the treelist and wont have a nice parent/child relationship to display properly. What I want is to only be able to display a partial view of the data around what the user searched on and have the data look like a "snapshot" of the entire treelist. Has anyone done anything like this or are there any suggestions? Any help is appreciated.
Peter Milchev
Telerik team
 answered on 07 Jun 2022
1 answer
56 views

Hello,

I am attempting to integrate the drag/drop feature into a RadTreeList. The dragging is enabled and seems to work great but when an item is dropped it attempts a postback but does not change position. I assume this is because I need to manually assign it a value in comparison to a parent item. Does anyone have any experience or examples they could provide to display this functionality better? The most I have found online was this brief article:

https://docs.telerik.com/devtools/aspnet-ajax/controls/treelist/items/items-drag-and-drop

My code:

       <telerik:RadTreeList ID="treeViewGrid" runat="server" DataKeyNames="ModuleId" CommandItemDisplay="Top" ParentDataKeyNames="ParentId" AutoGenerateColumns="false" EnableDragAndDrop="true">
            <ClientSettings AllowItemsDragDrop="true">
    <Selecting AllowItemSelection="True" />
                </ClientSettings>
            <Columns>

....

</columns>

....

 

Database:

moduleid
1
displayorder
1
moduletype
1
parentid
0
displayorder
2
moduletype
1
parentid
0
moduleid
2

 

 

My guess would be that there is a OnDropItem that runs server side where I can assign a new display order based on the previous order. Any help on this is appreciated! Thanks!

Eric R | Senior Technical Support Engineer
Telerik team
 answered on 13 Oct 2021
2 answers
85 views

 

Once we add a selection column to the radtreelist,  it left aligns the next column.   However we need the 2nd column to align with the checkbox, is OK for all other columns to align.   Thus for  your demo page, the behavior we need is the Bound Column to have "Appetizers" immediately after the check so it appears as a label for the checkbox.  How would I achieve this?

 

Van
Top achievements
Rank 1
Iron
Iron
 answered on 03 Aug 2021
1 answer
76 views

In Brief

The OnItemCommand ExpandCollapse event command doesn't fire when ClientSettings.AllowPostBackOnItemClick="true"

Detail

I am using a TreeList to display a company hierarchy. It is defined as follows.

<telerik:RadTreeList
    ID="lstCompanyTree"
    runat="server"
    PageSize="12"    
    AllowLoadOnDemand="false"    
    AllowPaging="true"
    Width="300px"     
    OnNeedDataSource="lstCompanyTree_NeedDataSource"
    OnItemCommand="lstCompanyTree_ItemCommand"
    OnDataBound="lstCompanyTree_DataBound"
    OnItemDataBound="lstCompanyTree_ItemDataBound"
    OnPageIndexChanged="lstCompanyTree_PageIndexChanged"
    OnPreRender="lstCompanyTree_PreRender"     
    AutoGenerateColumns="false"          
    AllowSorting="false"     
    CssClass="CompanyListTree"          
    ShowTreeLines="true"   
    ExpandCollapseMode="Server"
    DataKeyNames="CompanyID"
    ParentDataKeyNames="ParentCompanyID"
    ClientDataKeyNames="CompanyID,ObjectID"
    >
    <ClientSettings AllowPostBackOnItemClick="true" >
        <Selecting AllowItemSelection="true" />                      
    </ClientSettings>
    <AlternatingItemStyle BackColor="Transparent" />
    <ItemStyle BackColor="Transparent" />   
    <Columns>       
        <telerik:TreeListTemplateColumn >
            <ItemTemplate>
                <div class="CompanyListItem">
                    <div class="layoutRow" <%# Eval("Style") %>>
                        <div class="layoutCell dataCellMin200"><strong><%# Eval("Name") %></strong></div>
                    </div>     
                    <div class="layoutRow">
                        <div class="layoutCell dataCellMin200"><%# Eval("SubHeading")%></div>
                    </div>           
                </div>
            </ItemTemplate>           
        </telerik:TreeListTemplateColumn>
    </Columns>               
</telerik:RadTreeList>

 

I am trying to implement code when the Expand collapse button is clicked, and load the details of the company when an item is selected.

The problem is in the OnItemCommand event.

The ItemClick event command is overriding the ExpandCollapse command. If you disable AllowPostBackOnItemClick, then you get the ExpandCollapse command as expected.

that is, in this code block

protected void lstCompanyTree_ItemCommand(object sender, Telerik.Web.UI.TreeListCommandEventArgs e)
{
..
}

 

e.CommandName is always "ItemClick" when AllowPostBackOnItemClick is true.

if you disable AllowPostBackOnItemClick , then e.CommandName = "ExpandCollapse" when you click the ExpandCollapse button. I haven't been able to test the value when the item is clicked as the postback is disabled, but one would assume e.CommandName = "ItemClick" in this case.

 

 

Doncho
Telerik team
 answered on 18 Aug 2020
4 answers
91 views
I am trying to insert/edit items in the TreeList using a pop-up usercontrol.And when finish insert/update, user control can not close .Please tell me how to close Popup user control.Thank u .

Here is my code in User control :

<telerik:RadButton ID="btnInsert" runat="server" Text="Insert"   Width="75px"
                CommandName ="PerformInsert"
                Visible ="<%#DataItem is Telerik.Web.UI.TreeListInsertionObject %>"
                onclick="btnInsert_Click">
                <Icon PrimaryIconCssClass ="rbSave" />
        </telerik:RadButton>
        <telerik:RadButton ID="btnSave" runat="server" Text="Save"   Width="75px"
                CommandName ="Update"
                Visible ="<%#!(DataItem is Telerik.Web.UI.TreeListInsertionObject) %>"
                onclick="btnSave_Click">
              <Icon PrimaryIconCssClass ="rbSave" />
        </telerik:RadButton>
        <telerik:RadButton ID="btnCancel" runat="server" Text="Cancel"  Width="75px"
                CommandName ="Cancel"  CausesValidation="False">
                 <Icon PrimaryIconCssClass ="rbCancel" />
</telerik:RadButton>

Oscar
Top achievements
Rank 1
 answered on 28 May 2020
1 answer
169 views

     Hi,

 

I am working on a project where I am using RadTreeList as a control(creating it programmatically from .cs file).
I am trying to implement excel like filtering on the column headers but I couldn’t find a straight example/resource which guides me to do so.
I found a link which has a similar usage in kendo MVC.
https://demos.telerik.com/aspnet-mvc/dialog/treelist-integration

Is there a way we could implement this or a similar excel filter with RadTreeList?
I want to avoid using a separate control of RadFilter as demo shows on the website.
https://demos.telerik.com/aspnet-ajax/treelist/examples/integration/filteringwithradfilter/defaultcs.aspx?product=treelist

 

Thanks in advance for the help,

Swanand Nalawade

Eyup
Telerik team
 answered on 27 Mar 2020
2 answers
54 views

I haven't changed this page for years and now I'm suddenly getting this error coupled with 'Cannot read property 'Classic' of undefined': 

The exact errors are attached.

 

Vessy
Telerik team
 answered on 30 Aug 2019
1 answer
165 views
I love treelist. I have a web app needs to be viewed in mobile screens. To do so I need to hide some columns so treelist fits the screen. I did some experimets but none of them was successful.Lets say I have 10 columns and I need to hide 7 of them. I managed to hide them but rest of the columns nevert expanded to fill the screen. There always remain a white space at the left of treelist as if there's something occupies the space.


Can anyone please show me howto completely hide columns of threelist with CSS mediaquery please ? I've spent one week for this but no luck.

Best.
Eyup
Telerik team
 answered on 31 Jul 2019
5 answers
80 views
Hi, is there any way I can freeze columns in radtreelist with vertical and horizontal scrollbars?
I know there is no option for that, but is it possible from client-side?
Thanks
Peter Milchev
Telerik team
 answered on 26 Jul 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?