Link to home
Start Free TrialLog in
Avatar of pprasadravi
pprasadravi

asked on

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" />
    </Unit>
  </Group>
  <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" />
    </Unit>
  </Group>
</Course>

  HTML:

<asp:TreeView ID="tvSiteMenu" runat="server" DataSourceID="xdsMenuData"
            AutoGenerateDataBindings="False" OnSelectedNodeChanged="Select_Change"  PathSeparator=":" >
            <HoverNodeStyle BackColor="#66FFFF" />
            <SelectedNodeStyle BackColor="#66FF33" />
            <DataBindings>
                <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" />
            </DataBindings>
            <RootNodeStyle BackColor="#FF6600" />
        </asp:TreeView>
        <asp:XmlDataSource ID="xdsMenuData" runat="server"
              ></asp:XmlDataSource>

 Thanks in Advance

Ravi Potturi
ASKER CERTIFIED SOLUTION
Avatar of Kumaraswamy R
Kumaraswamy R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial