• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 401
  • Last Modified:

TreeView - State across my website

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
1 Solution

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now