Good morning! I would like to know if it is possible to save the state of the radtreelist with the nodes that were opened or closed and this way when the user reloads the screen it will be displayed the way it was before?
Radtreelist asp.net c#
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>
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?
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!
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?
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.
<
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
>
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
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.