asp.net-ajaxtelerikradtreeview

Expand Telerik RadTreeView (for ASP.net AJAX) on load


I'm wondering why I can't find a straight way to expand all nodes of a static RadTreeView on page load. I first traversed all its properties both from properties pane of Visual Studio and also I checked it from code-behind. I didn't find any single property to tell it to open it in expanded mode. Then I looked at the Telerik's website and unfortunately I didn't find any server-side solution to make it load in expanded mode.

Do you know any ways/tricks to load it in expanded mode?


Solution

  • I found the answer (expanding from code-behind):

    if (!IsPostBack)
            {
                foreach (RadTreeNode rtn in RTVControl.Nodes)
                {
                    rtn.ExpandChildNodes();
                    rtn.Expanded = true;
                }
            }