TreeView - State across my website

Posted on 2009-12-29
Last Modified: 2012-05-08
Hi ,

I am planning to use TreeView control for the below requirements with MasterPage. Could you please guide me to resolve this?

Below is my Sample XML which i get from data base and Sample Treeview code.

1. Display the XML structure in tree structure.

2. Expand the Selected Node and its next level nodes and collapase all other.

3. User has the ability to add new node. We get the XML structue from database when user create/delete the node(Course, Group, Unit and Lesson).

Create : Highlight the new Node when user create new node


XML Strucutre :

 <Course CourseID="45" NavigateURL="~/CourseDetails.aspx?Mode=Edit&amp;CourseID=45" CourseName="Asp.Net">
  <Group GroupName="Asp Session" GroupID="69" NavigateURL="~/GroupDetails.aspx?Mode=Edit&amp;GroupID=69">
    <Unit UnitName="Introduction To ASP Session" UnitID="74" NavigateURL="~/UnitDetails.aspx?Mode=Edit&amp;UnitID=74">
      <Lesson LessonName="Introduction to Inptoc Session" LessonID="191" NavigateURL="~/LessonDetails.aspx?Mode=Edit&amp;LessonID=191" />
  <Group GroupName="Data Controls" GroupID="68" NavigateURL="~/GroupDetails.aspx?Mode=Edit&amp;GroupID=68">
    <Unit UnitName="Introduction to Data Controls" UnitID="73" NavigateURL="~/UnitDetails.aspx?Mode=Edit&amp;UnitID=73">
      <Lesson LessonName="Introduction To Grid View" LessonID="189" NavigateURL="~/LessonDetails.aspx?Mode=Edit&amp;LessonID=189" />
      <Lesson LessonName="Introduction to List View" LessonID="190" NavigateURL="~/LessonDetails.aspx?Mode=Edit&amp;LessonID=190" />


<asp:TreeView ID="tvSiteMenu" runat="server" DataSourceID="xdsMenuData"
            AutoGenerateDataBindings="False" OnSelectedNodeChanged="Select_Change"  PathSeparator=":" >
            <HoverNodeStyle BackColor="#66FFFF" />
            <SelectedNodeStyle BackColor="#66FF33" />
                <asp:TreeNodeBinding DataMember="Course" NavigateUrlField=""
                    TextField="CourseName" ValueField="NavigateURL" />
                    <asp:TreeNodeBinding DataMember="Group" NavigateUrlField=""
                    TextField="GroupName" ValueField="NavigateURL" />
                    <asp:TreeNodeBinding DataMember="Unit" NavigateUrlField=""
                    TextField="UnitName" ValueField="NavigateURL" />
                    <asp:TreeNodeBinding DataMember="Lesson" NavigateUrlField=""
                    TextField="LessonName" ValueField="NavigateURL" />
            <RootNodeStyle BackColor="#FF6600" />
        <asp:XmlDataSource ID="xdsMenuData" runat="server"

 Thanks in Advance

Ravi Potturi
Question by:pprasadravi
    1 Comment
    LVL 29

    Accepted Solution


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now