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

Persist treeview state with static nav links

1 Answer 70 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
lafon Clark
Top achievements
Rank 1
lafon Clark asked on 15 Apr 2010, 05:32 PM
Hello,
   I'm attempting to use a radTreeView for navigation in a Master page.  Each link navigates to a content page.  The items are static in the html code, not loaded at runtime.  I can't seem to save the state between pages.  I'm using the code below, I didn't paste in the entire tree.  Can someone point me in the right direction.


telerik:RadTreeView ID="RadTreeView1" Runat="server"   
                    EnableAjaxSkinRendering="False" ShowLineImages="False"   
                    SingleExpandPath="True"  EnableEmbeddedSkins="False" 
                    Skin="MySkin" OnClientNodeClicked="ClientNodeClicked" OnNodeExpand="RadTreeView1_NodeExpand"   
            onnodecollapse="RadTreeView1_NodeCollapse"
protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!Page.IsPostBack && String.IsNullOrEmpty((string)Session["myTreeView"]))  
        {  
              
            Session["myTreeView"] = RadTreeView1.GetXml();  
        }  
        else if (!String.IsNullOrEmpty((string)Session["myTreeView"]) && (!IsPostBack))  
        {  
            string treeViewState = (string)Session["myTreeView"];  
            RadTreeView1.LoadXmlString(treeViewState);    
 
        }  
    }  
 
 
 
protected void RadTreeView1_NodeExpand(object sender, RadTreeNodeEventArgs e)  
    {  
        Session["myTreeView"] = RadTreeView1.GetXml();  
    } 
I am using node templates with links if it makes a difference.

<telerik:RadTreeNode runat="server"   
                            HoveredImageUrl="~/images/plus.jpg"    
                            ImageUrl="~/images/node-image.gif" Width="165px" > 
                             <NodeTemplate> 
                                  <href="ContactUs.aspx">Contact Us</a> 
                                  
                                </NodeTemplate> 
                        </telerik:RadTreeNode> 

1 Answer, 1 is accepted

Sort by
0
lafon Clark
Top achievements
Rank 1
answered on 22 Apr 2010, 03:16 AM
Any ideas?  Anyone?
Tags
TreeView
Asked by
lafon Clark
Top achievements
Rank 1
Answers by
lafon Clark
Top achievements
Rank 1
Share this question
or