Search code examples
c#asp.netdevexpresstreelist

DEVExpress's ASPXTreeList always returning same clientlayout


I am using the DevExpress's aspxtreelist and am having trouble saving the clientlayout with:

AspxTreeList.SaveClientLayout();

I got the gridview's and pivotgrid's SaveClientLayout to work but whenever I call the SaveClientLayout for treelist, it returns the same thing.

Code to save layout: (Tried in button click)

byte[] byte123 = tree.SaveClientLayout();
string layoutstring = Convert.ToBase64String(tree.SaveClientLayout());

Layoutstring:

AgAHAAcABwAG//8G//8G8P8CAVo=

My treelist code:

                    <dx:ASPxTreeList ID="ASPxTreeList1" runat="server" AutoGenerateColumns="False" ClientInstanceName="treeTo" DataSourceID="SqlDataSource" KeyFieldName="ID" ParentFieldName="PID" OnCustomCallback="ASPxTreeList1_CustomCallback" EnableTheming="True" Theme="Metropolis" OnClientLayout="ASPxTreeList1_ClientLayout">
                        <Columns>
                            <dx:TreeListTextColumn FieldName="ParentID" ShowInCustomizationForm="True" VisibleIndex="2">
                            </dx:TreeListTextColumn>
                            <dx:TreeListTextColumn FieldName="Text" ShowInCustomizationForm="True" VisibleIndex="3">
                            </dx:TreeListTextColumn>
                            <dx:TreeListTextColumn FieldName="NavigateURL" ShowInCustomizationForm="True" VisibleIndex="4">
                            </dx:TreeListTextColumn>
                            <dx:TreeListCommandColumn VisibleIndex="1">
                                <EditButton Visible="True">
                                </EditButton>
                                <NewButton Visible="True">
                                </NewButton>
                                <DeleteButton Visible="True">
                                </DeleteButton>
                            </dx:TreeListCommandColumn>
                        </Columns>
                        <Styles>
                            <Header CssClass="droppableRight"></Header>
                            <Node CssClass="droppableRight"></Node>
                            <AlternatingNode Enabled="True" CssClass="droppableRight">
                            </AlternatingNode>
                        </Styles>
                        <SettingsBehavior AutoExpandAllNodes="True" AllowFocusedNode="True" />
                        <SettingsPager AlwaysShowPager="True" Mode="ShowPager" PageSize="25">
                            <AllButton Visible="True">
                            </AllButton>
                        </SettingsPager>
                        <SettingsEditing AllowNodeDragDrop="True" />
                    </dx:ASPxTreeList>

Why is SaveClientLayout always returning the same layout string? It works perfectly for gridview and pivotgrid


Solution

  • Turns out treelist requires the cookies to be enabled. Enabling cookies worked