By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,334 Members | 2,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,334 IT Pros & Developers. It's quick & easy.

Xml based Tree menu help

P: n/a
I have one XML file that has nodes and sub node and each and every node has
the attribute call visible if its value is true then diplay this node else
don't display thid node, but this condition i am able to check using xpath in
asp.net 2.0 till MenuItem node. if i check visible attribute value till
SubMenuLevel0 node then in tree it will not display the MenuItem Node at all

Note: My tree Menu will start from MenuItem node and it will display all
nodes which has the attribute visible=true only.....

XML and aspx file are give below.
----------------------------
XML File : PauConfigMenu.xml
---------------------------
<?xml version="1.0" encoding="UTF-8"?>
<PauMenu Title="Main_Menu">
<MenuItem Text="Device View" ToolTip="Device View" Target="_Blank"
Url="~/Tree.aspx" visible="True"></MenuItem>
<MenuItem Text="Device Management" ToolTip="Device Management"
Target="_Blank" Url="~/Tree.aspx" visible="True">
<SubMenuLevel0 Text="Feature Cloning" ToolTip="Feature Cloning"
Target="_Blank" Url="~/Tree.aspx" visible="True">
<SubMenuLevel1 Text="Clone Features" ToolTip="Clone Features"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="Clone Status" ToolTip="Clone Status" Target="_Blank"
Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="View Cloning Log" ToolTip="View Cloning Log"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
</SubMenuLevel0>

<SubMenuLevel0 Text="Multi Device Configuration" ToolTip="Multi Device
Configuration" Target="_Blank" Url="~/Tree.aspx"
visible="True"></SubMenuLevel0>
<SubMenuLevel0 Text="Device Alert Log" ToolTip="Device Alert Log"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel0>
<SubMenuLevel0 Text="View Device Counts" ToolTip="View Device Counts"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel0>
<SubMenuLevel0 Text="Manage Device Groups" ToolTip="Manage Device Groups"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel0>
<SubMenuLevel0 Text="Device Discovery" ToolTip="Device Discovery"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel0>
<SubMenuLevel0 Text="Security" ToolTip="Security" Target="_Blank"
Url="~/Tree.aspx" visible="True">
<SubMenuLevel1 Text="SNMP Security" ToolTip="SNMP Security"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="MFP Security" ToolTip="MFP Security" Target="_Blank"
Url="~/Tree.aspx" visible="True">
<SubMenuLevel2 Text="Security Level" ToolTip="Security Level"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel2>
<SubMenuLevel2 Text="Single Security Setting" ToolTip="Single Security
Setting" Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel2>
<SubMenuLevel2 Text="Default Security Setting" ToolTip="Default Security
Setting" Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel2>
</SubMenuLevel1>
</SubMenuLevel0>

</MenuItem>

<MenuItem Text="Driver Management" ToolTip="Driver Management"
Target="_Blank" Url="~/Tree.aspx" visible="True">
<SubMenuLevel0 Text="Single Driver Configuration" ToolTip="Single Driver
Configuration" Target="_Blank" Url="~/Tree.aspx"
visible="True"></SubMenuLevel0>
<SubMenuLevel0 Text="Multi Driver Configuration" ToolTip="Multi Driver
Configuration" Target="_Blank" Url="~/Tree.aspx" visible="True">
<SubMenuLevel1 Text="Configure Driver" ToolTip="Configure Driver"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="Remove Driver Configuration" ToolTip="Remove Driver
Configuration" Target="_Blank" Url="~/Tree.aspx"
visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="Email Notify" ToolTip="Email Notify" Target="_Blank"
Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
</SubMenuLevel0>

<SubMenuLevel0 Text="Driver Database Management" ToolTip="Driver Database
Management" Target="_Blank" Url="~/Tree.aspx" visible="True">
<SubMenuLevel1 Text="Add Drivers To Database" ToolTip="Add Drivers To
Database" Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="Delete Drivers From Databasen" ToolTip="Delete
Drivers From Database" Target="_Blank" Url="~/Tree.aspx"
visible="True"></SubMenuLevel1>
</SubMenuLevel0>
<SubMenuLevel0 Text="Automatic Checking For New Drivers"
ToolTip="Automatic Checking For New Drivers" Target="_Blank"
Url="~/Tree.aspx" visible="True"></SubMenuLevel0>

</MenuItem>

<MenuItem Text="Firmware Management" ToolTip="Firmware Management"
Target="_Blank" Url="~/Tree.aspx" visible="True">
<SubMenuLevel0 Text="Firmware Download" ToolTip="Firmware Download"
Target="_Blank" Url="~/Tree.aspx" visible="True">
<SubMenuLevel1 Text="Single FW Download" ToolTip="Single FW Download"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="Delete FW" ToolTip="Delete FW" Target="_Blank"
Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="View Status" ToolTip="View Status" Target="_Blank"
Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="View Log" ToolTip="View Log" Target="_Blank"
Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
</SubMenuLevel0>
<SubMenuLevel0 Text="Firmware Installation" ToolTip="Firmware
Installation" Target="_Blank" Url="~/Tree.aspx" visible="True">
<SubMenuLevel1 Text="Single Device FW Installation" ToolTip="Single
Device FW Installation" Target="_Blank" Url="~/Tree.aspx"
visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="Multi Device FW Installation" ToolTip="Multi Device
FW Installation" Target="_Blank" Url="~/Tree.aspx"
visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="View Schedule Status" ToolTip="View Schedule Status"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="View Installation Status" ToolTip="View Installation
Status" Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="View Log" ToolTip="View Log" Target="_Blank"
Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
</SubMenuLevel0>

</MenuItem>


<MenuItem Text="Settings" ToolTip="Settings" Target="_Blank"
Url="~/Tree.aspx" visible="True">
<SubMenuLevel0 Text="Network Settings" ToolTip="Network Settings"
Target="_Blank" Url="~/Tree.aspx" visible="True">
<SubMenuLevel1 Text="SNMP" ToolTip="SNMP" Target="_Blank"
Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="Email (SMTP), AddressBook" ToolTip="Email (SMTP),
AddressBook" Target="_Blank" Url="~/Tree.aspx"
visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="Internet Proxy" ToolTip="Internet Proxy"
Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
<SubMenuLevel1 Text="SSL" ToolTip="SSL" Target="_Blank"
Url="~/Tree.aspx" visible="True"></SubMenuLevel1>
</SubMenuLevel0>
<SubMenuLevel0 Text="Configure Useful Link" ToolTip="Configure Useful
Link" Target="_Blank" Url="~/Tree.aspx" visible="True"></SubMenuLevel0>
<SubMenuLevel0 Text="Device SNMP Trap Registration" ToolTip="Device SNMP
Trap Registration" Target="_Blank" Url="~/Tree.aspx"
visible="False"></SubMenuLevel0>
</MenuItem>

<MenuItem Text="Useful Links" ToolTip="Useful Links" Target="_Blank"
Url="~/Tree.aspx" visible="True">

</MenuItem>

<MenuItem Text="Driver Download" ToolTip="Driver Download" Target="_Blank"
Url="~/Tree.aspx" visible="True">

</MenuItem>

<MenuItem Text="Help" ToolTip="Help" Target="_Blank" Url="~/Tree.aspx"
visible="false"></MenuItem>
</PauMenu>

-----------------------------------------------------------------------------
ASPX file : xmltree.aspx
------------------------------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="xmltree.aspx.cs"
Inherits="_Default" %>
<%@ Import Namespace="System.Xml" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head runat="server">
</head>
<body >
<form id="Form1" runat="server">
<table>
<tr>
<td valign="top" bgcolor="#fefcf5" height="550" width="300">
<asp:TreeView ID="PauMenuTreeView"
DataSourceID="PauMenuXmlDataSource" runat="server"
ImageSet="Msdn" NodeWrap="True" ShowLines="True"
ShowExpandCollapse="true" ExpandDepth="0"
BorderStyle="None" NodeStyle-Font-Size="small"
NodeStyle-Font-Names="Verdana"
HoverNodeStyle-BackColor="WhiteSmoke"
HoverNodeStyle-BorderColor="LemonChiffon"
HoverNodeStyle-BorderWidth="1px"
HoverNodeStyle-Font-Italic="true">
<SelectedNodeStyle ForeColor="#ff6666"/>

<DataBindings>

<asp:TreeNodeBinding DataMember="PauMenu"
TextField="Title" />
<asp:TreeNodeBinding DataMember="MenuItem"
TextField="Text" ToolTipField="ToolTip"
/>

<asp:TreeNodeBinding DataMember="SubMenuLevel0"
TextField="Text" ToolTipField="ToolTip"
/>
<asp:TreeNodeBinding DataMember="SubMenuLevel1"
TextField="Text" ToolTipField="ToolTip"
/>
<asp:TreeNodeBinding DataMember="SubMenuLevel2"
TextField="Text" ToolTipField="ToolTip"
/>
</DataBindings>

</asp:TreeView>
<asp:XmlDataSource ID="PauMenuXmlDataSource"
DataFile="PauConfigMenu.xml" runat="server"

XPath="./PauMenu/MenuItem[@visible='True']"></asp:XmlDataSource>

</td>
<td valign="top">
<h1>
</h1>
</td>
</tr>
</table>
</form>
</body>
</html>
-----------------------------------------------------------------------------

Aug 8 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.