Building a Database Driven Hierarchical Menu using ASP.NET 2.0
page 1 of 1
Published: 04 May 2006
Unedited - Community Contributed
Abstract
In this article, Michael demonstrates how to create a database driven hierarchical menu with only a few lines of code using ASP.NET 2.0. This is a must read tutorial for everyone who needs a professional menu that is powerful and flexible with simplistic design.
by Michael Libby
Feedback
Average Rating: 
Views (Total / Last 10 Days): 98685/ 54

Introduction

This tutorial will show you how to store hierarchical menu data in a single database table and how to retrieve and transform that data for display in Microsoft's Menu.

Each step is explained and illustrated so that you can quickly extrapolate from this article to build your web application's menu.

Note: This tutorial requires Visual Studio 2005 and SQL Server.

Step 1 - Create and Fill a Database Self Join Table

Our menu's table will use a self-join relationship which is the simplest method of storing hierarchical data. Child rows will use ParentID to establish a relationship with the MenuID of a parent row as shown below.

Figure 1 - Table Overview

 

Let us start by creating a database called MenuDb and a Table called Menu.  This can be done by running the following script from Microsoft's Query Analyzer.

Listing 1 - Database Script

CREATE DATABASE MenuDb
GO
USE MenuDb
GO
CREATE TABLE [Menu] (
      [MenuID] [intIDENTITY (1, 1) NOT NULL ,
      [Text] [varchar] (50) COLLATESQL_Latin1_General_CP1_CI_AS NULL ,
      [Description] [varchar] (255) COLLATESQL_Latin1_General_CP1_CI_AS NULL ,
      [ParentID] [intNULL ,
      CONSTRAINT [PK_Menu] PRIMARY KEY CLUSTERED 
      (
            [MenuID]
      )  ON [PRIMARY] 
) ON [PRIMARY]
GO
INSERT INTO MENU
Select 'Product','A List of Products'NULL
UNION ALL Select 'Applications','Appliations',NULL
UNION ALL Select 'Document','Documentation'NULL
UNION ALL Select 'Support','Support'NULL
UNION ALL Select 'Download','Download'NULL
UNION ALL Select 'Background','ProductBackground', 1
UNION ALL Select 'Details','Product Details', 1
UNION ALL Select 'Mobile Device','Mobile DeviceApplications', 2
UNION ALL Select 'Portal','Portal Applications',2
UNION ALL Select 'Web Applicaitons','WebApplications', 2
UNION ALL Select 'Demo','Demo Applicaitons', 2
UNION ALL Select 'Performance Tests','ApplicationPerformance Tests', 2
UNION ALL Select 'Tutorials','TutorialDocumentation', 3
UNION ALL Select 'Programmers','ProgrammDocumentation', 3
UNION ALL Select 'FAQ','Frequently AskedQuestions', 4
UNION ALL Select 'Forum','Forum', 4
UNION ALL Select 'Contact Us','Contact Us', 4
UNION ALL Select 'InternetRestrictions','Internet Restrictions', 6
UNION ALL Select 'Speed Solution','Speed Solutions',6
UNION ALL Select 'Application Center Test','Application Center Test Results', 12
UNION ALL Select 'Modem Results','Modem Results',12
GO

The table you created, displayed below, uses self-join relationships.  Rows that have a MenuID between 1 through 5 do not have parents and are considered root menu nodes.  Rows with MenuID of 6 and 7 are children of MenuID 1, and so on.

Figure 2- Parent, Child Relationships

 

Step 2 - Add a Web Page That Implements a Menu and an XmlDataSource

Add a new WebForm to your web application. Drag and drop a Menu and an XmlDataSource from the toolbar onto the WebForm with the following properties.

Listing 2 - Menu and XmlDataSource Web Controls

<asp:Menu ID="menu"DataSourceID="xmlDataSource" runat="server" 
BackColor="#FFFBD6"DynamicHorizontalOffset="2" Font-Names="Verdana" 
ForeColor="#990000"StaticSubMenuIndent="10px" StaticDisplayLevels="1" >
<DataBindings>
  <asp:MenuItemBindingDataMember="MenuItem" NavigateUrlField="NavigateUrl"
  TextField="Text" ToolTipField="ToolTip"/>
</DataBindings>
<StaticSelectedStyleBackColor="#FFCC66" />
<StaticMenuItemStyleHorizontalPadding="5px" VerticalPadding="2px" />
<DynamicMenuStyle BackColor="#FFFBD6"/>
<DynamicSelectedStyleBackColor="#FFCC66" />
<DynamicMenuItemStyle HorizontalPadding="5px"VerticalPadding="2px" />
<DynamicHoverStyleBackColor="#990000" Font-Bold="False"ForeColor="White"/>
<StaticHoverStyle BackColor="#990000"Font-Bold="False" ForeColor="White" />
</asp:Menu>
<asp:XmlDataSource ID="xmlDataSource"TransformFile="~/TransformXSLT.xsl"  
XPath="MenuItems/MenuItem"runat="server"/> 

At runtime, the XmlDataSource object is assigned an XML string (shown in step 3) which is then transformed by the XSLT file, TransformXSLT.xsl to another XML format (XSLT is covered in step 4).  The transformed XML is then consumed by the Menu as specified by the Menu's DataSourceID property.

Note: We are using the XmlDataSource property, XPath, to introduce an optional way to exclude the XML root node, MenuItems.  If the root node is not excluded then the menu will contain an extra level which can be controlled using the menu property StaticDisplayLevels.  The MenuItems root nodes can also be excluded in XSLT.

Step 3 - Retrieve Data and Create Nested Relationships

Now it is time to retrieve and begin formatting the menu data for use by Microsoft's menu.  The challenge is to establish parent child relationships and then create a hierarchical representation of the data.   A DataSet object is perfect for this because it can store the structure of an entire database, including relationships, and then convert that relational data into nested XML. 

Add the following C# code to your Page_Load method.  This code uses a DataAdapter to retrieve data from the single database table and to fill a DataSet.  Once filled, a DataRelation is applied to the DataSet to establish MenuID and ParentID dependencies.  Finally, a call to GetXML() retrieves a hierarchical XML representation of all relational data within the dataset.  

Listing 3 - The C# Code

using System;
using System.Xml;
using System.Data;
using System.Data.SqlClient;
 
public partial class _Default:System.Web.UI.Page
{
  protected void Page_Load(object sender,EventArgs e)
  {
    DataSet ds = new DataSet();
    string connStr = "server=localhost;Trusted_Connection=true;database=MenuDb";
    using(SqlConnection conn = newSqlConnection(connStr))
    {
      string sql = "Select MenuID, Text,Description, ParentID from Menu";
      SqlDataAdapter da = newSqlDataAdapter(sql, conn);
      da.Fill(ds);
      da.Dispose();
    }
    ds.DataSetName = "Menus";
    ds.Tables[0].TableName = "Menu";
    DataRelation relation = newDataRelation("ParentChild",
     ds.Tables["Menu"].Columns["MenuID"],
     ds.Tables["Menu"].Columns["ParentID"], true);
 
    relation.Nested = true;
    ds.Relations.Add(relation);
 
    xmlDataSource.Data = ds.GetXml();
 
    if (Request.Params["Sel"] != null)
      Page.Controls.Add(newSystem.Web.UI.LiteralControl("You selected " +
        Request.Params["Sel"]));
  }
}

Note: You will have to supply your relevant SQL Server name, Username and Password in the above database connection string, connStr.

As shown in the screenshot below, the call to ds.GetXml() correctly displays the nested hierarchy.

Figure 3 - XML Generated By Using DataSet Relationships

Step 4 - Using XSLT to convert XML for Microsoft's Menu

The XML returned from ds.GetXml() now needs to be reformatted for Microsoft's Menu. XmlDataSource is perfect for this task because it can use XSLT to transform the above XML to another XML format and then provide that to Microsoft's menu.

The below XSLT code does just this.  It first finds the root node called Menus and applies the MenuListing template to its root children. Next, each Menu node's elements are converted to MenuItem attributes.  Finally, each Menu node is checked for the existence of children.  If children exist, then the MenuListing will be recursively called until all children are processed.

Add an XSLT file to your project named TransformXSLT.xsl with the following code.

Listing 5 - XSLT

<?xml version="1.0"encoding="utf-8"?>
<xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml"indent="yes" encoding="utf-8"/>


  <!-- Replace root node name Menus with MenuItems
       and call MenuListing for its children-->
  <xsl:template match="/Menus">
    <MenuItems>
      <xsl:call-templatename="MenuListing" />
    </MenuItems>
  </xsl:template>
  
  <!-- Allow for recursive child nodeprocessing -->
  <xsl:templatename="MenuListing">
    <xsl:apply-templatesselect="Menu" />
  </xsl:template>
  
  <xsl:template match="Menu">
    <MenuItem>
      <!-- Convert Menu child elements to MenuItem attributes -->
      <xsl:attributename="Text">
        <xsl:value-of select="Text"/>
      </xsl:attribute>
      <xsl:attributename="ToolTip">
        <xsl:value-ofselect="Description"/>
      </xsl:attribute>
      <xsl:attributename="NavigateUrl">
        <xsl:text>?Sel=</xsl:text>
        <xsl:value-ofselect="Text"/>
      </xsl:attribute>
      
      <!-- Recursively call MenuListing forchild menu nodes -->
      <xsl:if test="count(Menu) >0">
        <xsl:call-templatename="MenuListing" />
      </xsl:if>
    </MenuItem>
  </xsl:template>
</xsl:stylesheet>

Note: You can interactively debug an XSLT and an XML file from the IDE's XML Menu.

The XmlDataSource object's transformed XML that is provided to Microsoft's Menu is shown below.

Figure 4

    

Step 5 - Run the Web Page

Run your web page to display the following menu.

Figure 5 - The Final Output

Downloads

[Download Sample]

Conclusion

This article shows how to create a menu using a self-join database table, SqlDataAdapter, DataSet, DataRelation, XML, XmlDataSource and XSLT using just a few lines of code.   The self-join table stores parent child menu relationships.  The SqlDataAdapter fills the Dataset.  The DataSet employs a DataRelation which is used to create a nested XML.  XmlDataSource then applies the XSLT to the nested XML transforming it for use by Microsoft's Menu.

My next article will build upon this example and show how to create a WebForm that manipulates a database driven hierarchical menu.

Please provide feedback, letting me know how you liked this article.  Happy coding!

References

Use the below references to learn how to create table relationships, format menu styles and convert XML using XSLT.

·         MSDN - Adding a Relationship between Tables

·         Menu Quick Start Tutorial

·         Transforming XML with XSLT and ASP.NET



User Comments

Title: iphone game app   
Name: iphone game app
Date: 2013-01-23 5:24:12 AM
Comment:
I agree with most of the points you make within this content.
Title: Mr.   
Name: BJ
Date: 2012-11-05 9:08:54 AM
Comment:
Thank you very much. This artical saved me lot of time, although I found it later in my searches but hey, everything worked out so good.

Thanks!
Title: only sub menus should have navigate url   
Name: behnam
Date: 2012-08-05 3:28:47 PM
Comment:
i want only sub menus should have navigate url please help me.
Title: Nice   
Name: Yogesh Thorat
Date: 2012-08-04 8:15:19 AM
Comment:
Nice article it helps me to do my data driven menu thanks.
Title: i cant see the description images   
Name: Mahesh
Date: 2012-06-06 2:28:58 AM
Comment:
the article u have written is very nice but the images which are shown as example cant been dispalyed here without that i cant can't create anything bcoz i am just a fresher and looking to impress people for getting a job sp please i kindly request u to give a small and simple description to create dynamic menus in a web page.............
Title: Wholesale new jordans,nike foamposite,Levis jeans   
Name: yong cheng
Date: 2012-05-28 9:22:23 AM
Comment:
we wholesale cheap jordan shoes,nike air max 2012,Prada
shoes,Polo shoes,supra shoes,Christian Louboutin
shoes,louis vuitton shoes,The North Face coat,gucci,True
Religion jean.Moncler coat.
Title: id of the menu items   
Name: anonymous
Date: 2012-03-15 6:28:59 AM
Comment:
how to make the menu respond the same way with keyboard tab key as it respond to mouse pointer
Title: url navigation   
Name: Munirajan
Date: 2011-12-20 3:58:46 AM
Comment:
i need navigation click event
Title: DBMenu   
Name: Kulasekaralwar.c
Date: 2011-12-13 7:44:20 AM
Comment:
Can you provide me click event for page navigation
Title: where is the article   
Name: david
Date: 2011-11-10 9:54:15 AM
Comment:
where is the article, I can't find anywhere to read this article
Title: Article Missing   
Name: Pallab
Date: 2011-10-31 12:48:29 AM
Comment:
Where is the article?
Title: Error   
Name: Lasse
Date: 2011-10-30 3:32:44 AM
Comment:
Ohhh I need this article...
Title: Error   
Name: Roman
Date: 2011-10-29 4:26:18 AM
Comment:
I don't see article, only Abstract?
Title: Building a Database Driven Hierarchical Menu using ASP.NET 2.0   
Name: Simi Sreedharan
Date: 2011-10-18 11:59:47 AM
Comment:
Nice article. Thanks
Title: need a help in this ...   
Name: ajith
Date: 2011-10-09 9:30:30 AM
Comment:
hi.. This article helped me so much.. Here am getting a trouble that i cannot see the sub menus .I can see the main 4 menus only. If i click on a menu then a blank page is showing..... Please help me
Title: amit   
Name: Amit
Date: 2011-10-09 12:58:24 AM
Comment:
Hi!..This article was really helpful but can u tell me how can i create horizontal 2 level menu using mysql and c# in asp.net 3.5 not using xml but mysql as my database.
Title: الهی خدا بهت خیر بده و سربلند بشی   
Name: Omid Rahimi
Date: 2011-09-12 1:58:59 PM
Comment:
thank u for your complete Example.

I am very gald and happy now for seen your training.

Have Good time with best wishes...
Title: Good   
Name: Bhargav
Date: 2011-08-16 2:59:43 AM
Comment:
article is Good But i want to display menuleval 1 horizontally can you help me forward to bhargav_it89@yahoo.com
Title: Null reference error in master page with VB flavour   
Name: Shail
Date: 2011-07-20 3:53:04 PM
Comment:
first of all Thanks for good work. I have implemented this it seems working fine with simple page but when i used it in master page its giving me a nullreference error
Below is the Stacktrace for the same. I tried casching option on/off but no luck.
[NullReferenceException: Object reference not set to an instance of an object.]
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +24
System.Xml.XmlDocument.Load(XmlReader reader) +96
System.Web.UI.WebControls.XmlDataSource.PopulateXmlDocument(XmlDocument document, CacheDependency& dataCacheDependency, CacheDependency& transformCacheDependency) +231
System.Web.UI.WebControls.XmlDataSource.GetXmlDocument() +154
System.Web.UI.WebControls.XmlHierarchicalDataSourceView.Select() +14
System.Web.UI.WebControls.Menu.DataBindItem(MenuItem item) +97
System.Web.UI.WebControls.Menu.PerformDataBinding() +117
System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect() +82
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.Menu.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.Menu.EnsureDataBound() +29
System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript) +21
System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e) +22
System.Web.UI.Control.PreRenderRecursiveInternal() +77
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

That would be great if some one can help me out
Title: chinese tea   
Name: chinese tea
Date: 2011-06-15 12:15:24 AM
Comment:
Nice post Amazing, I found your site on Bing looking around for something completely unrelated and I really enjoyed your site. I will stop by again to read some more posts.
Title: menu click event   
Name: Katta
Date: 2011-05-25 1:35:57 PM
Comment:
Hi,
Thanks for the article. I am using this code in my website and works very well. Now I got a new requierement. Particular web page(aa.aspx)can be accessed as menu item or it can be accessed via link on another page. So, in aa.aspx I need to know how it is accessed. Is it accessed as menu item click or from another source page. I do not know how to capture the click event of menu item.
I appreciate your response.
Thanks,
Katta
Title: Not Updating New Adding Menu item   
Name: Ram Kumar
Date: 2011-05-18 5:59:54 AM
Comment:
Hi
First of all thanks for you excellent work. i am new in aps.net programmer. i am searching this kind of article. Your article is most help full in my website.
but i am getting so problem when i am adding new item in menu it cannot update when i am open control panel and just open the transform.xlst file and update it work fine.
any solution plz reply.
kumar88.ram@gmail.com
Title: Not giving quick response   
Name: chandrashekhar
Date: 2011-04-25 6:33:49 AM
Comment:
An Excellent piece of code and a very nice work indeed.

But if i add more items in the table then it does not updating on page refresh or after application build.

But After restarting the application it works fine.
Why it is so.?
bisht.chandrashekhar@gmail.com
Title: thanks, i use that in vb.net   
Name: Ana
Date: 2011-04-19 3:28:53 PM
Comment:
thanks, aspx is the same, in the xsl i change names for the ones in my procedure.

this is my example .vb:

Private Sub cargaMenu()
Try
Dim ds As New DataSet
Using cnn As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionString").ToString)
cnn.Open()
' Define the command
Using cmd As New SqlCommand
cmd.Connection = cnn
cmd.CommandType = CommandType.Text
cmd.CommandText = "pa_menu"
' Define the data adapter and fill the dataset
Using da As New SqlDataAdapter(cmd)
'ds = New DataTable
da.Fill(ds)
End Using
End Using
End Using
ds.DataSetName = "Menus"
ds.Tables(0).TableName = "Menu"
'Dim relacion As DataRelation = New DataRelation("parentChild", ds.Tables("menu").Columns("nivel"), ds.Tables("menu").Columns("parent"), True)
Dim relacion As DataRelation = New DataRelation("parentChild", ds.Tables("menu").Columns("id_menu"), ds.Tables("menu").Columns("parent"), True)
relacion.Nested = True
ds.Relations.Add(relacion)
'Me.XmlDataSource1.EnableCaching = False
Me.XmlDataSource1.Data = ds.GetXml
Catch ex As Exception
Throw New Exception(ex.Message)
End Try

End Sub
Title: very clearly   
Name: Khanh
Date: 2011-03-19 4:19:50 AM
Comment:
I tested. It has been running in vs 2005 and vs 2008
Thank you so much!
Title: FeedBack   
Name: Ashish
Date: 2011-03-19 3:18:34 AM
Comment:
Thnx man!!..Awwsum.!!
Title: Dynamic Menu   
Name: Gurmeet singh
Date: 2011-02-09 7:17:23 AM
Comment:
Every things is ok but how to link menu
Title: Feedback   
Name: qwerty
Date: 2011-02-02 4:35:03 AM
Comment:
Nice article
Title: Issue in 2008   
Name: sathees balakrishnan
Date: 2011-01-20 1:20:38 AM
Comment:
the same code is not working in vs2008.any can help.
Title: Only Menu arrow show   
Name: Yogesh
Date: 2011-01-06 2:40:21 AM
Comment:
Only Menu arrow show,but xml file get proper data...
so plz help me....
my id is..yogesh88.sharma@yahoo.in

display menu arrow this formats

> >
> >
>
>
Title: How to create sub-sub mebu   
Name: Anant
Date: 2010-12-22 8:31:43 AM
Comment:
Hi,
Works nicely and I am able to create Menu -> Sub Menu
How can I add further levels?
Title: Binding menu control to sql datasource in asp.net 3.5   
Name: suchitra
Date: 2010-11-30 10:32:34 PM
Comment:
I have a table with only 1 column and want to display that column(category_name) in the menu control in a horrizontal orientation... I am not able to bind menu control to sql data source.. please help...
The table is category_master with one column category_name
Title: how to nlevel   
Name: skhurams
Date: 2010-11-29 8:45:34 AM
Comment:
how to get nlevel menu in asp.net where you dont know how many level are ther in submenu
Title: how can i navigate   
Name: jim (jimkalis@gmail.com)
Date: 2010-11-18 5:14:38 PM
Comment:
how can i navigateurl seems not working? any help???
Title: in chrome not working   
Name: jim (jimkalis@gmail.com)
Date: 2010-11-18 5:05:05 PM
Comment:
please help not work in google chrome??? any help???
Title: Thanks for ur code, problem in MaximumDynamicDisplayLevels="5"   
Name: Hussain
Date: 2010-11-04 6:17:33 AM
Comment:
Hi for posting such a nice article. previously i used datatable for binding menu control but it was very slow. Now using xmldatasource it is working fine.
But one problem when i set MaximumDynamicDisplayLevels="5" it is slowin IE but fast in Firefox.
Is thier any alternative solution?
Title: Seems to be working   
Name: Vimal Upadhyay
Date: 2010-10-25 6:15:33 AM
Comment:
It seems to be working, great, lets try me in my app first
Title: Problem with navigation?   
Name: Arpit Gupta
Date: 2010-10-22 4:55:41 AM
Comment:
how to pass two parameter in navigate URL?
we can pass only one value
in select text

what o do to display as
AllProducts.aspx?catid=""&subcatid=""
Title: Dynamic Menu Creation   
Name: Debasmit Samal
Date: 2010-10-12 3:17:37 PM
Comment:
Really Excellent... No query regarding understanding....Excellent
Title: Bug in code   
Name: Vikas Gupta (prakashtechno.gp@gmail.com)
Date: 2010-09-21 1:34:46 AM
Comment:
code is not working on google chrome. could u pls solve it. thanks in advance.
Title: code   
Name: sandipr05@gmail.com
Date: 2010-09-15 4:08:10 AM
Comment:
dynamic menu
Title: EnableCaching Properties on xmlDataSource   
Name: Noel Jerome
Date: 2010-09-13 4:46:46 AM
Comment:
This Database driven menu is superb, just a minor issue though that everyone may know. If you will try to add or edit entries in the database and run default.aspx you will notice that what you entered or edited wasn't incorporated in the Menu shown on the HTML of default.aspx. Although when you trace in by debugging you will see that it exist. The reason behind this non-show-up on the menu is the "EnableCaching" Properties on xmlDataSource. Just go to the default.aspx and change the EnableCaching Properties of xmlDataSource from TRUE to FALSE. This should get your menu working. Just reset the Properties later on. Or if you think there is no use of caching, keep it to False. Cheers and happy coding.
Title: Nice content   
Name: Prakash Gupta
Date: 2010-09-13 12:59:20 AM
Comment:
article is very help full. it works fine but i got exception some time named 'InvalidOperationException: This document already has a 'DocumentElement' node'. how to handle it??? pls solve this problem.
Title: Nice Tutorial   
Name: Arry Suseno
Date: 2010-09-09 6:51:15 AM
Comment:
That's article is very help full but I can link to urlnavigates, how to do that? can you show that coding to me?
thank's
arry_suseno@yahoo.com
Title: Great Article Abhi - Can you please post your solution   
Name: Ram
Date: 2010-08-19 2:26:14 PM
Comment:
Very nice article
Hi Abhi,

I am facing the same problem as mentioned by you. Did you ever get around this issue. If so, please post the solution
Title: Bug in your code   
Name: Hemnat
Date: 2010-08-02 8:01:36 AM
Comment:
if i create page in sub directory then it will not work
Title: Developer   
Name: Dominic Ralph
Date: 2010-07-29 2:11:59 AM
Comment:
Hi Michael Libby,
The article is excellent. Thank you for explaining all the elements very clearly. Kindly explain how the xml schema can be updated immediately as the changes made in mssql server so that it would reflect the menu items. Presently menu items are remain unchanged till the schema has been refreshed. My email : dominicralph@gmail.com
Title: Developer   
Name: Abhi
Date: 2010-07-28 10:12:15 AM
Comment:
Hi,
I have tried to implement the above code exactly using Asp.Net 3.5, C#. I followed the above steps exactly.

I have kept the menu control in the master page, and wrote the given code in masterpage.cs - page load.

The problem I am facing is, I am only able to see the first level( parent menus), on the click of arrow of a parent menu I do not see any corresponding sub-menu.

Can any one please tell me is there any modification required to whts been said in the article, is anyone facing the same problem?
Title: VB code   
Name: DEEPU
Date: 2010-07-22 12:00:29 AM
Comment:
Pls provde VB code also
Title: VB.NET Version   
Name: Nada
Date: 2010-06-30 1:00:12 AM
Comment:
Thanks shona(and Michael for writing this article)! I'm a newbie & I too was getting the "Object reference not set to an instance of an object" error when converting it from C#. I ended up adding the Handles keyword and changing the AutoEventWireup back to 'False' (the default when a VB .aspx page is created)

http://support.microsoft.com/kb/814745

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Title: thank   
Name: mohamded
Date: 2010-06-26 6:59:11 AM
Comment:
thank you
Title: Using LINQ to SQL to create custom ASP.NET menu control   
Name: Chris Beckman
Date: 2010-06-14 11:42:10 PM
Comment:
using System;
using System.Configuration;
using System.Data;
using System.Data.Linq;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;



namespace Virtual
{
public class MainMenu : WebControl
{
public MainMenu()
{


}


protected override void CreateChildControls()
{
//Define working objects
Menu _mnu = new Menu();
Virtual.linq.linqDataContext _dc = new Virtual.linq.linqDataContext();
XDocument _menuXML = new XDocument();
XmlDataSource _xmlDS = new XmlDataSource();

//Define LINQ to SQL Query
XElement root = new XElement("menuXML",
from m in _dc.menus
where m.parentid == null
select GetMenuXML(m));


_xmlDS.Data = _menuXML.Document.ToString();

_mnu.DataSource = _xmlDS;

RenderMenu(_mnu);


this.Controls.Add(_mnu);
this.Controls.Add(_xmlDS);

}


private static XElement GetMenuXML(Virtual.linq.menu menu)
{
return new XElement("category",
new XAttribute("MenuID", menu.id),
new XAttribute("Text", menu.text),
new XElement("Description", menu.description),
new XElement("menus", menu.childMenus.Select(m => GetMenuXML(m))));
}


private static void RenderMenu(Menu _mnu)
{
//Set Behaviour of Control
_mnu.Orientation = Orientation.Horizontal;
_mnu.StaticDisplayLevels = 1;
_mnu.MaximumDynamicDisplayLevels = 2;
_mnu.Enabled = tru
Title: Open URL in New Window   
Name: Mike Jackson
Date: 2010-06-03 10:10:19 AM
Comment:
Hello,

Would like to open some URL's in a new window.

Using either:
1. Javascript window.open
or
2. target="_blank"

Would like to call from database.

Please Help:)

Thanks
Title: To James   
Name: Alpesh Savani
Date: 2010-05-12 2:27:03 AM
Comment:
Hi James,
I know it is great tutorial and i have store user access data separately.

I have created 4 tables
1. for all page Name,PageCode(PK) & links in my project
2. User Name,Right Code(FK)(Permission Code)
3. Master Rights - Rights Details like Right Code (PK), RightName

4. Transaction Rights - Rights Code(FK),Page Code(FK)
Title: To Alpesh Savani   
Name: James
Date: 2010-04-26 7:43:28 PM
Comment:
This is a great tutorial. I have achieved a treeview report menu by learning this tutorial.

Hi Alpesh Savani
You might need to create another table to store user access and then join your menu table. So each user should be able to access different menus.

By the way, your xml should be unique as per user and dynamically populated.

e.g. User A and B might see their menu at the same time.
I attached a guid to each xml file. code as below:

string fileName = Path.Combine(filePath, System.Guid.NewGuid().ToString() + "_" + DateTime.Now.ToString("yyyymmdd_hhmmss") + ".xml");
Title: Need Help :Problem ocurring in my project using this code   
Name: Alpesh Savani
Date: 2010-04-20 3:33:40 PM
Comment:
Hi,
I am Alpesh Savani and I have a problem using this code in my project,
my menu is not refreshed on every login/logout.

I am using this code to create user's menu as per his/her page rights.
Eg: User1 has right for Page1 and Page2
then user can see only their links.
User 1 cant see Page3 in his menu...

Usualy it fetches data of previously logged in user's menu and It becomes static menu for all the users.


If you have the solution or any type of sugession then please mail me on "alpesh08@gmail.com" , Its urgent
Title: if (Request.Params["Sel"] != null)   
Name: Capster
Date: 2010-04-19 8:53:38 PM
Comment:
HI. GREATE EXAMPLE. i HAVE ONE QUESTION THOUGH CAN YOU PLEASE EXPLANIN THE BELOW CODE IN DETAIL. HOW ARE YOU AND WHERE ARE YOU SETTING THE KEY FOR PARAMS "SEL". HOW IS GETTING SET. PLEASE HELP YOU CAN EMAIL TO CAPACITOR143@YAHOO.COM
.if (Request.Params["Sel"] != null)
Page.Controls.Add(newSystem.Web.UI.LiteralControl("You selected " +
Request.Params["Sel"]));
Title: Disply the links on master page   
Name: vijaykumar
Date: 2010-04-09 5:57:56 AM
Comment:
in master page want to display my link example product>>background>>application like this i want to display please how can i do this one..?

thanks in advance.......
Title: navigate url value   
Name: Vijay kumar
Date: 2010-04-09 5:55:52 AM
Comment:
how can i retrieve the menu item values... according to this article........... please any one help me....
Title: not working   
Name: nic
Date: 2010-04-02 11:59:24 PM
Comment:
not working on internet explorer 7
Title: Solve my problem   
Name: shona
Date: 2010-04-01 2:36:23 AM
Comment:
Hi,
I just change in my vb.net design file..
add AutoEventWireup="false"
and its working...
Thanks Michael Libby for this Awesome Work....
Title: VB.net version   
Name: shona
Date: 2010-04-01 12:57:16 AM
Comment:
Hi,

dos anyone please a working VB.net version of the above C# code? Ran it through a converter but I am getting an "Object reference not set to an instance of an object" error.
Please would some kind soul help me out with this!
Title: dbmenu   
Name: raj
Date: 2010-03-23 8:26:00 AM
Comment:
if i select any web page its not redirecting and its showing the current page in the address with ?sel=

any can one help me?
Title: Building a Database Driven Hierarchical Menu using ASP.NET 2.0   
Name: Milton
Date: 2010-03-22 5:58:50 AM
Comment:
It`s very nice,then please help "help how to display sitemap path with the same xslt menu control"...
Title: rd   
Name: vinod
Date: 2010-03-16 9:11:27 AM
Comment:
thanks
Title: RD   
Name: Not able to get value of Request.Params["Sel"]
Date: 2010-03-15 11:29:02 PM
Comment:
Clicking on Product, make page blank at once. Not showing anything. Please suggest me..Copied all the code after downloading all the code.
Title: useful article   
Name: amit kumar
Date: 2010-03-11 12:38:03 PM
Comment:
Its very useful article .

thanks for posting
Title: Greatfull Article   
Name: vijay kumar
Date: 2010-03-10 5:57:59 AM
Comment:
it is very useful... and thanks .. am trying for this
please provide in three layer architecture
Title: Nice Piece of Work   
Name: malyadri kakolu
Date: 2010-03-10 5:56:58 AM
Comment:
i got what i want wid dis............
Title: good article   
Name: Malyadri kakolu
Date: 2010-03-10 2:51:18 AM
Comment:
its very helpfull
Title: Grate Article   
Name: Maulik
Date: 2010-03-06 4:19:00 AM
Comment:
Grate article .....

But i failed to understand working of XSLT file here. How it maps parent child relation during menu generation??

Please help me..
Title: Sorting   
Name: Alex
Date: 2010-03-05 4:06:07 PM
Comment:
Great job.
Did somebody have a solution for sorting?
i often change or add some items and must then resort all ids.
Title: its ok   
Name: Alam
Date: 2010-03-04 4:27:48 AM
Comment:
Ignore guys, I just able to figure it out. Thank you
Title: fail   
Name: alam
Date: 2010-03-04 3:10:18 AM
Comment:
Hi, thank you for great article of yours. However when I try it (in VB) its fail somehow, here is my code while the rest is exactly the same

Private Sub GetMenus()
Dim Dts As DataSet
Dts = MenuGenerator() 'fill the dataset
Dts.DataSetName = "Menus"
Dts.Tables(0).TableName = "Menu"
Dim Relasi As DataRelation = New DataRelation("ParentChild", Dts.Tables("Menu").Columns("MenuID"), Dts.Tables("Menu").Columns("ParentID"), True)
Relasi.Nested = True
Dts.Relations.Add(Relasi)
Dim Instant As New XmlDataSource
Instant.Data = Dts.GetXml()
If Request.Params("Sel") Is DBNull.Value Then
Page.Controls.Add(New System.Web.UI.LiteralControl("You selected " & Request.Params("Sel")))
End If
End Sub

the error massage is "Object reference not set to an instance of an object". I believe it related with the xsl file but I cant figure it out. Any idea?? Thanks
Title: Dynamic Menu using xmlDatasource   
Name: DK
Date: 2010-03-04 2:28:49 AM
Comment:
Hi Jones/Joe

Try setting the XmlDataSource objects EnableCaching property to false for your problem

Hope this solves your problem
Title: Dynamic Menu using xmlDatasource   
Name: DK
Date: 2010-03-04 2:23:21 AM
Comment:
This article is very helpful & simple to impletement when dynamic menu is requried to be built for different users/application within the project
Title: Navigate url   
Name: Asif
Date: 2010-03-03 4:30:27 AM
Comment:
hi,
the article is xtreemly helpful.This z really what i want in my project.Now,on every menuitem click, i want to send user to the same page with diff. ID.
I M not clear about how to do it.Maybe i've to play with navigateUrl in XSLT file.
PLease do needful.
thank U.
with regards ,
Asif
MCA final.(KU)
Title: Dynamic Menu Drive from Access Database   
Name: Software Developer
Date: 2010-03-03 3:28:27 AM
Comment:
Thanks...but i need to connect with access
Title: One Small Doubt   
Name: Jones
Date: 2010-02-08 7:39:00 AM
Comment:
Hi

Thanks for your Nice Article. I have one small Doubt, actually i ve created one master page with asp.net Menu, While loading the master page i created one dataset with (Menus table) Based on Roles i have update this dataset every time.

But the problem is, as soon its loading it will take the previous dataset unless session had expired.

That means, in my Menus table there are 2 menus for Developer, 3 Menus for DBA and 5 Menus for Admin (for Ex). First Time if i login with Developer, its shows 2 menus exactly. if signout and sign in again with admin, instd of 5 menus it again shows the 2 Menus of Developer. After some time (after session expired) if i login with admin, it shows 5 menus exactly..

Hope u understand my problem, Also i have tried with all session things. i have closed all session variable using Abondent,Remove All,Clear,.... But no use.

Can u please help me out from this problem.

Thanks in Advance,
Joe
Title: hi   
Name: Saxena V.
Date: 2010-02-08 7:25:07 AM
Comment:
I used the code and working fine except, when the appication containing this menu is browsed from another machine on network then the submenu items are not displayed. In place white background is shown.

Kindly do suggest.
Title: Thanks   
Name: Andrey
Date: 2010-02-07 7:52:15 AM
Comment:
Thanks a lot, i made the database myself exactly like you did, but i had problem writing a code. Your sample helped me at some point.
Title: Precise and straight to the point   
Name: Olabode Bowoto
Date: 2010-01-29 11:40:20 AM
Comment:
thank you very much,this article is indeed a beautiful piece ,for an individual like me ,that is into sofware Engineering(web application Development).
Title: Very Good   
Name: Sunil Mishra
Date: 2010-01-25 3:53:16 AM
Comment:
This look like a goode and simpal way to create database driven menus and it works greate !!!

Tahnks it is very helpfull
Title: Very Nice   
Name: Yatish
Date: 2010-01-25 12:48:10 AM
Comment:
Thanks I am new in software developing so I didn't know any thing about it. This Article helped me very much.
now i am waiting for your next article on web form for manipulating Menu.
thank you very much.
Title: Content Management   
Name: payal
Date: 2010-01-19 2:08:32 PM
Comment:
i needed database driven menu for my cms based website...and i find it here now i m gonna try this code,,
Thank you so muchhh
Title: its me Raksha   
Name: Raksha
Date: 2010-01-18 6:31:50 AM
Comment:
its not so much help full
Title: Database driven hierarchical menu   
Name: Manjunathns Sampangi
Date: 2010-01-15 12:26:18 AM
Comment:
Really very good explanation on Hierarchical Menus.you have shown How to build Self joins which is very helpful in Real-time applications.Thanks Good Work
Title: Grrrreat!!   
Name: Pata
Date: 2010-01-08 3:50:14 PM
Comment:
Amazing how since 2006 you get positive comments about this awesome piece of code. It's almost artistic :). Thank you very much.
Title: Error   
Name: rajan
Date: 2010-01-08 7:03:25 AM
Comment:
m getting the blank page please help me
i have a doubt whether i need to create a xml file and if i create wat r all the content should i giv there
Title: Thank you so much   
Name: Bard
Date: 2010-01-06 4:50:18 PM
Comment:
Wow! I found this in the nick of time. It works beautifully! Thank you so much.
Title: Developer   
Name: Irshad
Date: 2010-01-06 3:35:27 PM
Comment:
Hi,
Thank you very much for this code
Title: developer   
Name: ved
Date: 2010-01-05 5:13:06 AM
Comment:
very nice creation.
Title: Good   
Name: Deeps
Date: 2010-01-01 9:02:04 PM
Comment:
This is good, however you can also skmMenu from Scott Mitchelle and also available on MSDN Cutting edge. It is open source . This is a role base menu which was created to address the absence of standard menu controls in .net framework 1.1. Today menu control in .net 2.0 etc. is taken from this.
Title: Awesome Work   
Name: Upendra
Date: 2010-01-01 9:31:31 AM
Comment:
This is awesome work, something really useful.
Title: Good Code   
Name: Priya
Date: 2009-12-29 3:12:34 AM
Comment:
Good
Title: database driven menu   
Name: Amit Agarwal
Date: 2009-12-02 2:19:03 AM
Comment:
Thanks, It's too good, good work
Title: Database driven menu   
Name: Ashish
Date: 2009-11-27 11:18:56 PM
Comment:
Nice article.. Keep sharing.

Thanks,
Ashish
Title: Menus   
Name: Dharmendra Singh Rajput
Date: 2009-11-18 6:49:59 AM
Comment:
This is a very helpful example fro me, But I want to generate a Tree Menu from the above table. I was tried previously using yours article but i did not getting success.

Please help, My mail id is "dharmendra.rajput06@gmail.com". If u post any article related to my problem please mail me.
Thanks in advacnce.
Title: Menus   
Name: Akbar Shah
Date: 2009-11-10 8:06:32 AM
Comment:
you did great job. i use your code in my project. thanks for providing code.
Title: r4 firmware   
Name: r4 firmware
Date: 2009-10-12 3:35:09 AM
Comment:
Thanx for the valuable information. This was just the thing I was looking for,Building a Database Driven Hierarchical Menu using ASP.NET 2.0...... keep posting. Will be visiting back soon.
Title: Managing Menu Item from Admin Screen   
Name: Moez
Date: 2009-10-04 12:44:07 PM
Comment:
I'm trying to create managing menu item from the admin screen so I don't have to go to database to create or edit one. How could I do that, there's anyway, please help.

Thanks,

Mo
Title: Simple and neat   
Name: Dag
Date: 2009-09-01 3:42:57 PM
Comment:
Very good article. It helped me a lot!
Title: database driven menu (dynamic menu) without using xml   
Name: Chirag
Date: 2009-08-27 4:17:40 AM
Comment:
You can also create a menu without the use of XML :

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
PopulateMenu();
}

DataSet GetMenuData()
{
string connString
= "your connection string";
MySqlConnection con = new MySqlConnection(connString);
MySqlDataAdapter dadCats = new MySqlDataAdapter("SELECT columnname FROM table", con);
DataSet dst = new DataSet();
dadCats.Fill(dst, "table");
return dst;
}

public void PopulateMenu()
{
DataSet dst = GetMenuData();
foreach (DataRow Row in dst.Tables["table"].Rows)
{
MenuItem Item = new MenuItem((string)Row["columnname"]);
Menu1.Items.Add(Item);
}
}

protected void Menu1_MenuItemClick1(object sender, MenuEventArgs e)
{
if (Menu1.Items[0].Selected)
{
Response.Redirect("MenuItemContent1.aspx");
}
if (Menu1.Items[1].Selected)
{
Response.Redirect("MenuItemContent2.aspx");
}
if (Menu1.Items[2].Selected)
{
Response.Redirect("MenuItemContent3.aspx");
}
if (Menu1.Items[3].Selected)
{
Response.Redirect("MenuItemContent4.aspx");
}
if (Menu1.Items[4].Selected)
{
Response.Redirect("MenuItemContent5.aspx");
}

}
Title: Help   
Name: Ramesh Kumar S
Date: 2009-08-23 5:26:02 AM
Comment:
Hi,

Thanks for help in advance.
I need the whole path of the menu which clicked.

for example: you selected Product->Background->green

please help me..
mailid: srameshdaniel@gmail.com

Thanks,
Adroits
Title: Using Target attribute   
Name: Kamal
Date: 2009-08-15 6:01:34 AM
Comment:
It's a very good article; I want to use it in my project but I have another requirement. I have another database column "Target" contains null or _blank; how can I use these values to assign Target property to menuitem so it responds accordingly.
Thanks
Title: Greate article   
Name: Natale
Date: 2009-08-06 2:45:20 AM
Comment:
Thanks!
Title: Having some problem in Displaying Menus   
Name: Salman
Date: 2009-08-04 1:03:20 AM
Comment:
Hey... I have to give the same functionality into my project.. that menus should come from database.. I am following each steps mentioned in this Article But cant Able to solve my problem.. Let me the Know the solution ... I am getting this error
Circular reference in self-nested table 'tblsec05'.

Here is my Code please
(page.cs COde)
ds.Clear();
string sql = "select * from tblsec05";
SqlDataAdapter da = new SqlDataAdapter(sql,con);
da.Fill(ds);
da.Dispose();
ds.DataSetName = "Menus";
ds.Tables[0].TableName = "tblsec05";
DataRelation relation = new DataRelation("ParentChild",
ds.Tables["tblsec05"].Columns["moduleid"],
ds.Tables["tblsec05"].Columns["m_id"],true);
relation.Nested =true;
ds.Relations.Add(relation);
xmldatasource.EnableCaching =true ;
xmldatasource.Data = ds.GetXml();
Title: Well Done   
Name: Ryan
Date: 2009-07-22 3:49:29 AM
Comment:
Thanks. This is a great post. Should make a book out of it.

To make the nodes display. Add ontreenodepopulate="TreeView1_TreeNodePopulate" to the treeview that is created in the aspx file. This should solve a big problem
Title: Excellent   
Name: KV Subrahmanyam
Date: 2009-07-21 1:28:49 PM
Comment:
The content mentioned here is very nice and useful.
The content is like - ready to build in the projects.

Very nice.
Title: Update XSLT   
Name: yogesh d
Date: 2009-07-08 6:03:18 AM
Comment:
Try setting the XmlDataSource objects EnableCaching property to false.

and thanks to author very much ^--^
Title: Put menu level !   
Name: congbang(congbangs2003@yahoo.com
Date: 2009-07-04 4:38:14 AM
Comment:
I want to put menu order by with another column in 'Menu' table.It's not order by primary Key('MenuID').That mean i insert a column name: 'Codelevel' into table 'Menu' with values :'01','0102','0103','02','0201',....,'0822',..,n level.And I want the level of menu is arranged with that level.
Can someone please provide any solution?
Title: Implementing in Master page   
Name: Galib (mdgalib@hotmail.com)
Date: 2009-07-02 1:10:29 PM
Comment:
Hello,
Thanks for this great article. I have general question. If this type of database driven menu implemented for master page where the menu resides on the left side and content in the middle. Each time user clicks on the menu, master page will refresh the whole page and thus, the menu will be re-generated which means call to database again.. Can someone please provide any solution?
Title: Sub-menu's in IE8   
Name: Carsten
Date: 2009-07-01 11:19:17 AM
Comment:
Read this page, why the sub-menu's arent showing in IE8, and how to get it solved

http://forums.asp.net/p/1426614/3182111.aspx
Title: Feedback   
Name: Thienthai
Date: 2009-06-20 10:04:59 AM
Comment:
it to difficult is there any way to create dynamic menu from database, i don't want to use XSLT
Thanks
Title: Download URL dose not work !   
Name: SAM
Date: 2009-06-12 2:39:31 PM
Comment:
Greetings to you

Download URL dose not work ?
could you repair it !
Title: database instead of XML   
Name: Rahul
Date: 2009-06-06 5:55:46 AM
Comment:
hi, thanks for ur code....
but i want the code in a such a way that the menu can be build dynamically through database.
Title: romove the arrow   
Name: ben
Date: 2009-06-03 6:14:38 PM
Comment:
You remove the arrow by setting the StaticEnableDefaultPopOutImage to false
Title: Problem   
Name: AA
Date: 2009-05-29 1:40:03 AM
Comment:
Hi,
I impelmented this logic.
I have 2 different types of users for which dataset ds will get data depending on usertype.
But the prob is xmlDataSource.Data=ds.getXml()
will get new updated data from ds.
But xmlDataSource.GetXmlDocument().InnerXml will continue to have menu data of previous user.
So menu for this user is showing previous user's menu only.
Please help.
Title: Excellent   
Name: Ellien
Date: 2009-05-21 6:54:08 AM
Comment:
Your Job is very very fantastic. but it not work in Google chrome browser
Title: problem   
Name: prabu
Date: 2009-05-21 6:47:39 AM
Comment:
when i using this code i got one error
"The specified node cannot be inserted as the valid child of this node, because the specified node is the wrong type. "

but i can't solve this problem
Title: Title: Treeview Name: Emmanuel Voignier   
Name: Fahad
Date: 2009-04-24 4:52:47 AM
Comment:
I ve created treeview with the above sample.. but dat is in VB.net.
if u want it I can provide. mail me at fahadpathan@in.com
Title: Still not working   
Name: SnopBear
Date: 2009-04-22 2:33:44 PM
Comment:
I tried everything! Why don't you answer?
Title: Menu Bar   
Name: Suresh Babu Karuppiah
Date: 2009-04-22 12:40:40 AM
Comment:
It's very good sample.Very much thankful to you. It will be useful to my up coming project.
Title: This is marvelous   
Name: Bioscom
Date: 2009-04-21 2:41:00 AM
Comment:
A great work you have done here, you have saved me a lot of time and reduce the size of files I need to develop my web application.

I used oracle database to do my job and it worked well. But I have this problem, I defined a field in my table which I called NAVIGATEURL, I put the url of the forms I want to see when I click any of the menu, but it is not going to the page, instead it generates errors.

I tries to represent my URL this way ~/Common/IsaacBejide.aspx.

I configured everything in the stylesheet and I believe it should work.

If I put mouse pointer on any of the menu, on the browser's status bar, I can see my URL correctly displayed but the thing doesn't work.

Please what can I do, and do you already have your next article published?

Thank you.

Bioscom
Title: VB version for a Database Driven Hierarchical Menu using ASP.NET 2.0   
Name: Teng
Date: 2009-04-19 6:54:39 PM
Comment:
I've got a huge demand for this since I last posted my comments up here. Instead of sending it to everyone by email. I have placed this at http://terazu.brinkster.net/dbmenuvb.zip

You just need to change the connection string. I’m using a stored procedure to retrieve data from database. So you may want to change this code if you’re using SQL statement query.

Teng
Title: Just Last Problem.....(& read for solutions)   
Name: vipin
Date: 2009-04-09 6:46:47 AM
Comment:
Hi everyone,
XML DataSource cache property must be set to false.
MenuItemClick event won't fire, if we set NavigateURL Field of Menu Control.

Sub Menu Control doesn't shows up properly in Google Chrome or IE8 n Higher. IE7 n Firefox v3.0.8 are supporting it perfectly.

My last question, if I click on Product (the first option), I get "HTTP Error 400 - Bad Request" error.

Anybody, who can help about this?

Otherwise its just perfect!
Title: SubMenu not showing   
Name: Wonder Hlongwane
Date: 2009-03-31 4:41:12 AM
Comment:
Hi, the SubMenu is not showing when I hover over the main main menu. But if I go and put Response.Write(ds.GetXml()); after
xmlDataSource.Data = ds.GetXml();
it works.
Please help
wonder.hlongwane@yahoo.com
Title: thank you   
Name: thank you
Date: 2009-03-30 11:59:35 AM
Comment:
very good sample
Title: Database Not Updating Instantaneously!   
Name: bra
Date: 2009-03-30 7:02:57 AM
Comment:
Hello I have the same problem like vipin.Is there an alternate solution for this problem? Please help me.
Title: Event Not Firing   
Name: vipin
Date: 2009-03-29 10:13:23 AM
Comment:
Menu item click event is not firing. Please help. I am stuck nowhere.
And setting XMLDataSource Enable Caching property to false solve's my previous problem...
please help about this Menu Item Event not firing problem, somebody please help
Title: Database Not Updating Instantaneously!   
Name: vipin
Date: 2009-03-26 6:19:24 AM
Comment:
Hi,
thanks for your code. It works perfectly. But there is a problem, the changes in the database are not reflected instantaneously!
I don't know why, but if I modify SQL Database, then run it again in Visual Studio, the changes are not reflected. Then I have to close Visual Studio, SQL Server also once. Then I try it again, the changes are reflected. Any idea what might be causing this? All I want to say it, changes are not reflected instantaneously. Otherwise it works perfeclty.
thanx
Title: Please Help   
Name: scott baldrdige
Date: 2009-03-18 9:31:17 AM
Comment:
Hello, can anyone explain how to modify the TransformXSLT.xsl so that links with ampersands can be used. Currently they can't. How can I use Server.HtmlEncode with the .xsl?
It currently displays the correct link but when you capture the text with Request.Params(Sel) you only get the value befor the ampersand.
Title: Feedback   
Name: Shoukat Ali
Date: 2009-03-11 11:18:51 AM
Comment:
This artical is really nice peice of work. But i have one problem with the downlaoded source code sample. I changed the underlying database to mysql . the code runs perfectly and displays the menu as well, but it doen not displays the content of the database.
Title: Fine   
Name: syam sundar india
Date: 2009-02-25 6:25:23 AM
Comment:
thanx
Title: Moving links up or down   
Name: Lucious
Date: 2009-02-09 8:02:44 AM
Comment:
Hi there:
Can you provide me with the code of positioning the links up or down and also the code of navigating to a page.

Your help will be appreciated.
Title: Moving links up or down   
Name: Lucious
Date: 2009-02-09 7:53:42 AM
Comment:
Hi there:
Can you provide me with the code of positioning the links up or down and also the code of navigating to a page.

You help will be appreciated.
Title: error   
Name: Jithendar
Date: 2009-02-02 6:56:02 AM
Comment:
when i use access database for the same i am getting the error"This constraint cannot be enabled as not all values have corresponding
parent values" pl help me
Title: IIS 5.1 vs IIS 6.0   
Name: Amine
Date: 2009-01-24 5:00:41 AM
Comment:
Many thanks indeed for the great solution.
The menu works great when i run it on IIS 5.1. However, when i run it on IIS 6.0, the menu does not build properly. All the items are positioned below each other, no tree format.
Can you help me please?
Title: Treeview error   
Name: Oded Dror
Date: 2009-01-22 3:03:11 AM
Comment:
Hi there,
When I run the code I'm getting
Object reference not set to an instance of an object

Thanks,
Oded Dror
Title: TY,Navigation using menu control   
Name: Ashish Sharma
Date: 2009-01-21 7:37:17 AM
Comment:
hye
thank you ,article is awesome
what i want is almost what u have demonstrated here.but i want to make the user navigate when he/she clicks on the menu item,to another page(related to the menu item).Can these be done with this control?
Title: Thanks   
Name: Rizqi
Date: 2009-01-20 11:44:11 AM
Comment:
hi man, your doing a great job.
it's working properly.
but, if you gave me an edit menu form. I'll be thankful for that, just sent to my email aiqie@yahoo.com.:D
Title: Sitemap   
Name: Fred
Date: 2009-01-02 5:49:08 PM
Comment:
Great Article !
anyone knows if it is possible to generate a sitemap dynamically using this solution?

thx
Fred
Title: Working project in VB   
Name: Teng
Date: 2008-12-29 6:14:58 PM
Comment:
First of all, just want to thank Michael Libby for such great article.

I have a working VB version of this, if anyone is interested: tfoo@lsim.com.au

I have also enhanced this version to include sorting so you can sort the menu whichever order you specify in the database!
Title: Code not working   
Name: Xius
Date: 2008-12-22 4:53:45 PM
Comment:
I am using following code and line ds.Relations.Add(relation);
gives following error.

protected void Page_Load(object sender, EventArgs e)
{
DataSet ds = new DataSet("Menus");
DataTable dt = new DataTable("Menu");
ds.Tables.Add(dt);

dt.Columns.Add("MenuID");
dt.Columns.Add("Text");
dt.Columns.Add("Description");
dt.Columns.Add("ParentID");

UniqueConstraint uc = new UniqueConstraint(ds.Tables[0].Columns[0]);
ds.Tables[0].Constraints.Add(uc);

DataRow Row1 = ds.Tables["Menu"].NewRow();
Row1["MenuID"] = 1;
Row1["Text"] = "text 1";
Row1["Description"] = "desc 1 ";
Row1["ParentID"] = "";
ds.Tables["Menu"].Rows.Add(Row1);

DataRow Row2 = ds.Tables["Menu"].NewRow();
Row2["MenuID"] = 2;
Row2["Text"] = "text 2";
Row2["Description"] = "desc 2";
Row2["ParentID"] = "";
ds.Tables["Menu"].Rows.Add(Row2);

DataRelation relation = new DataRelation("ParentChild",
ds.Tables["Menu"].Columns["MenuID"],
ds.Tables["Menu"].Columns["ParentID"], true);

relation.Nested = true;
ds.Relations.Add(relation);

xmlDataSource.Data = ds.GetXml();


Any help.. ???
Title: Thank You   
Name: Ankit Gupta
Date: 2008-12-13 6:44:56 AM
Comment:
Sir your code has helped me so much in my project. Is there any way i can contact you for my further queries??
Title: Its simply great   
Name: Sameer
Date: 2008-12-10 2:43:37 PM
Comment:
This ir simply great, I was able to get a fledged tree view and its very fast and sleek.. thanks a lot
Title: Thanks Buddy   
Name: raj
Date: 2008-12-04 1:27:34 AM
Comment:
Thank u very much..it was very useful
Title: menu bar   
Name: Zaki
Date: 2008-11-21 5:48:34 AM
Comment:
hi

This is actually what I need

thnaks ]
Title: Navigate, Page title, Desription   
Name: Mehmet Nevresoğlu
Date: 2008-11-13 4:39:40 AM
Comment:
I want to navigate page from menu item click? and I want to change page title and meta tag's description for site optimization. How can I ?
Title: Navigation   
Name: Anil goswami
Date: 2008-11-10 2:40:05 AM
Comment:
I want to navigate page from menu item click? how can I ?
please send me the clue for it ? thanks in advance ..
Title: good solution   
Name: bhavin
Date: 2008-11-08 6:59:08 AM
Comment:
but i want navigation url for each menu item so wat to do?mail bhavinshah_r@yahoo.com
Title: Very Nice Article, Everyboby liked it so much..thank you..   
Name: Ram Dongre, Sacramento.
Date: 2008-10-31 6:45:01 PM
Comment:
Hi,
Hi this is indeed a very nice representation of hierarchical data. I used this approach to replace a series of cascading dropdowns which had lots of associated complexity on which prior dropdown being selected. This approach works so well with my code that well-written redundant menus are very staright forward and for user selection is just about following the leaf node!

Thank you for giving us a novel idea!!

Regards,
Ram Dongre.
Title: Really I can't experess my happens   
Name: Md Imran
Date: 2008-10-30 12:09:41 PM
Comment:
last 3 days i was thinking about this problem but nothing have findout any solution about this as per my logic ,but really the code is working aboustly working fine, thank to all of u to give us this solution ....

Md Imran
Vodafone Essar
System Anylyst
9811220682
Title: Menu gets reset   
Name: Prashant
Date: 2008-10-28 11:53:27 AM
Comment:
Hi -

Menu doesn't work properly using master pages when I do redirect. Here is the problem

1. I get the values from database using a store proc.
2. Changed the xsl to have URL instead of TEXT
3. This is how I am redirecting
if (Request.Params["Sel"] != null)
Response.Redirect(Request.Params["Sel"], false);
4. I login into my webpage, Menu populates
5. When I click on any sublink it takes me to that pages. It works fine here.
6. But when I click on any other sublink of the menu, Request.Params["Sel"] resets to null and won't redirect.
7. After that if I click again it will work.

I used XmlDataSource objects EnableCaching property to false but no help.

I tried using server.Transfer, now this work fine as expected, however my CSS files won't get populated with this and there is no background displayed.


Any one any idea please....?

Thanks in advance,
Prashant
chintap@hotmail.com
Title: Menu gets reset   
Name: Prashant
Date: 2008-10-27 9:59:18 PM
Comment:
I have a new problem in my development with this menu. After I login Menu populates it works fine when I click on any submenu. However it

Request.Params["Sel"] sets to null when I click on any of the sublink again and goes to home page.

I tried using EnableCache=false

Any help please...

Thanks,

Prashant.
chintap@hotmail.com
Title: Awsome, just what I was looking for   
Name: Rixter
Date: 2008-10-22 12:52:53 PM
Comment:
I utilized this code and it worked like a charm. I'm currently adding another DISPLAY table so that the menu will be dynamic based on the user profile (using .Net membership). Had issue where logging out would not reset menu bar until I disabled cache in the Datasource, as another suggested. THANK YOU THANK YOU THANK YOU!
Title: Great Article   
Name: Rob
Date: 2008-10-21 3:02:48 PM
Comment:
Does anyone know how you can order the categories i.e. in alphabetical or something?
Title: Nice Article   
Name: arthi
Date: 2008-10-16 7:04:42 AM
Comment:
But how to create mutilingual for this menu.
Pls Help ...
Thanks in advances
Title: Wonderful article   
Name: arthi
Date: 2008-10-16 7:02:38 AM
Comment:
Nice article
Title: There are some probs   
Name: Pankaj
Date: 2008-10-01 6:43:03 AM
Comment:
Hi thanx for this nice article, and i have applied it in my project, i have some probs, when i insert record in our database, and refresh page then menu don't find new record it shows only old menu record untill i clear cookie files. tell me is there any thing wrong?
Title: nested xml with multiple cols   
Name: Anees Shaikh
Date: 2008-09-29 7:55:32 AM
Comment:
Hi,
what if i have multiple dependecies like 2nd col is dependent on 1st, 3rd is dependent on 2nd, 4th is dependent on 3rd. then how we will generate the nested xml,
plz help
Thanks
Title: Menu   
Name: Prashant Reddy
Date: 2008-09-27 12:53:52 AM
Comment:
Hi -

This article is good. It works with SQL Server, but when I try with Oracle database, it doesn't display menu items. Anyone Any idea?

Thanks,
Prashant.
Title: Very Cool   
Name: Shahab farahbakhsh
Date: 2008-09-25 5:02:27 AM
Comment:
thank You Very Much
That Was Very Cool .
Title: Object Reference Error   
Name: Mayank Kukadia
Date: 2008-09-22 2:52:21 AM
Comment:
First Of all Thank you verymuch for this greate greate article.
We impelmented this logic in our web control having two menu in it (We have two menu in same control both menu use the same 'Transform.xsl').
Normally it works fine but some time getting "System.NullReferenceException" error, Moreover some time IE also crashes.
Below is the Stacktrace for the same.
[NullReferenceException: Object reference not set to an instance of an object.]
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +24
System.Xml.XmlDocument.Load(XmlReader reader) +96
System.Web.UI.WebControls.XmlDataSource.PopulateXmlDocument(XmlDocument document, CacheDependency& dataCacheDependency, CacheDependency& transformCacheDependency) +231
System.Web.UI.WebControls.XmlDataSource.GetXmlDocument() +154
System.Web.UI.WebControls.XmlHierarchicalDataSourceView.Select() +14
System.Web.UI.WebControls.Menu.DataBindItem(MenuItem item) +97
System.Web.UI.WebControls.Menu.PerformDataBinding() +117
System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect() +82
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.Menu.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.Menu.EnsureDataBound() +29
System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript) +21
System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e) +22
System.Web.UI.Control.PreRenderRecursiveInternal() +77
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360


Please help us to resolve the problem, it will be highly
Title: Circular Reference   
Name: Jason
Date: 2008-09-17 12:52:08 PM
Comment:
You will get the circular reference error if you have a record in the Menu table that is pointing to itself.

You may also get a similar error if you delete a parent node that has children. So make sure your delete handles deleting child nodes.
Title: Very Good   
Name: Mohammad javed comm-IT India P. Ltd.
Date: 2008-09-09 1:57:04 AM
Comment:
Very nice procedure and code..
Title: This is not working   
Name: kannan
Date: 2008-09-03 11:04:22 AM
Comment:
Hi ,

Any one can help to guide me ,how this is working ..I have copied and put it all the code but doesn't work .

Any setup do i need to do ? any one can help .

Thanks
Title: This is not working   
Name: kannan
Date: 2008-09-03 10:22:13 AM
Comment:
\
\
\
\
\
\
\
\
Title: This is not woking at all   
Name: kannan
Date: 2008-09-03 10:19:57 AM
Comment:
what are the necessary steps need to do
Title: Help   
Name: John
Date: 2008-08-10 7:38:07 PM
Comment:
I am not using ASP, can I do this with CFML and use CSS?
Title: Thankx   
Name: Qureshi
Date: 2008-08-06 8:35:32 AM
Comment:
Thank you very very very very much :)

it's really helpful for me.
Title: Exellent tutorial   
Name: Magnus
Date: 2008-07-20 8:14:28 PM
Comment:
I have to thank you for a very good tutorial,this was exactly what I was looking for. I have tried to do this with SQL and FOR XML but I didn't get it to work.

However I have a little problem with this. Ihave added af page where you can add links to the db. That works fine, but it takes avery long time before they shows up onthe pages. I have my menu in a usercontrol and added to all pages. Is ther someone of you out there how knows whats wrong?
Title: Excellent Work But want to add Url   
Name: Jose
Date: 2008-07-15 3:16:12 AM
Comment:
Thanks a lot this is wat i was looking for,

I have included field for Url, SELECT and changed Transformfile as follows,

〈xsl:attribute name="NavigateUrl"〉
〈xsl:text〉?Sel=〈/xsl:text〉
〈xsl:value-of select="Text"/〉
to
〈xsl:attribute name="NavigateUrl"〉
〈xsl:text〉?Sel=〈/xsl:text〉
〈xsl:value-of select="Url"/〉

But still not navigating to url Plz advise me, Urgent
Title: Treeview   
Name: Emmanuel Voignier
Date: 2008-07-14 3:53:28 PM
Comment:
Do you have the same tutorial using a treeview instead of a menu? Thanks
Title: Menu Rollovers   
Name: Scott Brady
Date: 2008-07-14 1:32:38 AM
Comment:
Hi,

Thanks for an excellent tutorial.

I have read and used this tutorial successfully in my own projects. The only problem that I have is in implementing a rollover effect with the static menu items.

I would like to have it such that when the mouse is overed over the main menu it there is a rollover effect that remains static until the mouse cursor leave one of the submenu items. Is this acheivable with this database driven menu structure.

Any help you can provide would be greatly appreciated.

Thanks In Advance

Scott Brady
Title: Menu refresh question   
Name: Dave
Date: 2008-07-10 12:22:47 PM
Comment:
I figured out that if I log off and on again that the menu will refresh with newly added items. Actually I also found that if I delete an item it goes away if I just refresh the screen. I guess this has something to do with session information. What do you think? Thx
Title: Menu refresh question   
Name: Dave
Date: 2008-07-09 6:47:34 PM
Comment:
Hi, Great article. I implemented this and it works well. I have one issue though. I created a few pages to maintain the sql table which feeds the xml/xslt. The changes that are in my sql table don't seem to show up in the menus until I do a rebuild of my project. Is that what you would expect or am I missing something? Thx
Title: Circular Reference Solved   
Name: Amit
Date: 2008-07-05 6:40:57 AM
Comment:
plz mail me for solution amitvijay79@yahoo.com
Title: greate Work But   
Name: SnopBear
Date: 2008-06-19 8:37:24 AM
Comment:
greate work But I try to make with two table but it dosen't work . so just try to make an other one and try to upload it any way thanks for your efforts
Title: Awsom Article   
Name: Shahid
Date: 2008-06-06 11:09:18 AM
Comment:
Comprehensive and very good article.If some one have problems with menu items cashed. Just set EnableCache=false
of the data source.
Title: Awesome Article Michael   
Name: Akhil
Date: 2008-05-23 12:20:49 PM
Comment:
Thanx a Lot 4 the Article Michael.

I had problems with CachedMenuItems. Thanx 2 ur prev post ... ive set the EnableCache=false. it Works!!!

Thanx Again!
Title: Excellent article   
Name: Primo
Date: 2008-05-14 12:54:37 AM
Comment:
vey helpful Thank's a lot
Title: Mr   
Name: Pillay
Date: 2008-04-16 8:33:55 AM
Comment:
This solution works good for loading menu from database.
Bt i want to open or redirect to a new page when user clicks on any menu.
how can i achieve this??
please Help..
Sundra.Pillay@webmail.co.za
Thanks in advance
Title: Outstanding Job   
Name: Andreidy Rosa
Date: 2008-04-09 1:16:49 PM
Comment:
Good Job Michael, I only can give you congratulations for this thx
Title: The Followup Article?   
Name: Noobzilla
Date: 2008-04-05 12:17:48 PM
Comment:
Hiya. I was just wondering if you ever wrote the follow-up article?
Title: Coolness   
Name: Robin Hansen
Date: 2008-03-28 5:23:07 PM
Comment:
I like this sample - despite I cannot get it to work with my SQL server 2005 express - any ideas...?
Title: eXCELLENT   
Name: Jaime Espinosa
Date: 2008-03-22 1:00:13 AM
Comment:
Thinking about scalability, simplicity, elegance... Th xslt trick...
Title: Awesome   
Name: sai
Date: 2008-03-20 5:29:42 AM
Comment:
excellent code
very easy
i'm using it
n it works fine .......... :)
Title: Need Helo   
Name: Krishna
Date: 2008-03-17 11:26:04 AM
Comment:
When i am using this code in vb.net i got object reference not set tobe an instance of object. what the problem. I this code xmldatasource.data = ds.getxml() means what??
How to tranfor xml file to xls file. Is it create its own. i need very urgent i am waiting for this answers

thanks kridhna
Title: Excellent   
Name: shahul
Date: 2008-02-28 2:04:30 AM
Comment:
Excellent Article
Title: Great article!   
Name: eric
Date: 2008-02-27 4:23:12 PM
Comment:
Thanks for the great article! But, I seem to get the following error:

Exception Details: System.ArgumentNullException: 'column' argument cannot be null. Parameter name: column I haven't changed anything in the code

I haven't changed any of the code in your sample. Any help would be greatly appreciated. Thanks
Title: how to clear dataset after signing out?   
Name: josey
Date: 2008-02-27 4:49:30 AM
Comment:
Ans: DS.Clear();
Title: Thanks   
Name: Josey
Date: 2008-02-27 4:45:46 AM
Comment:
good
Title: re:how to clear dataset after signing out?   
Name: Penofgod
Date: 2008-02-24 1:07:28 AM
Comment:
Try setting the XmlDataSource objects EnableCaching property to false.

and thanks to author very much ^--^
Title: how to clear dataset after signing out?   
Name: doug
Date: 2008-02-23 6:53:23 AM
Comment:
I used this example in my page with login. After I signed out of the page and then signed in again, the menu was still the same with the previous username. Do you have any suggestion on how to clear the dataset after signing out?
Title: updation   
Name: shailendra
Date: 2008-02-19 7:02:42 AM
Comment:
menu is not updated for a long time after updating or inserting ne data in menu table.
ds.getxml() and xslt.xls both shows new inserted values but not shown in menu control.
plz help or suggestion
Title: thanx   
Name: maxpayn2
Date: 2008-02-17 10:35:23 AM
Comment:
damet garm , it meanse thanx alooooooooooooot
Title: menu   
Name: jayant
Date: 2008-02-04 2:52:48 AM
Comment:
excelent
Title: sav   
Name: savio
Date: 2008-01-23 2:52:43 PM
Comment:
How can i display ,Building a Database Driven Hierarchical Menu using ASP.NET 2.0, on a gridview or repeater
Title: RE: Disable Navigation on root items   
Name: Mark
Date: 2008-01-04 6:06:01 AM
Comment:
Actually I used onMenuItemDataBound but instead of hard coding the item text to disable it, I just put:

if (e.Item.NavigateUrl == "")
e.Item.Selectable = false;

This stops the postback on items that have no NavigationURL when click upon.

Thanks for the great solution!
Title: Disable Navigation on root items   
Name: Mark
Date: 2008-01-04 5:36:25 AM
Comment:
Hi, great work with this. It worked great and I created another table to use for role permissions on the pages.

The only problem I have is not knowing how to set the root items to non-selectable without using the onMenuItemDataBound method because I can only hard code the item text I'm am looking for.

Is there a way to disble the root items because I don't want a javascript postback on items that have no NavigationUrl?
Title: Thanks bt need some more help   
Name: Manoj
Date: 2008-01-03 6:39:47 AM
Comment:
Hey this solution works good for loading menu from database.
Bt i want to open or rediredt to a new page when user clicks on any menu.
how can i achieve this??
please Help..
Title: AWESOME   
Name: MANOJ
Date: 2007-12-27 6:25:30 AM
Comment:
HEy its awesome....
HELPED ME A LOT...
THANKS...
Title: Nothing is displaying   
Name: Avi
Date: 2007-12-19 3:14:23 AM
Comment:
I m using ur code but nothing is displaying on the running page.
what is the issue plz help me soon.
Thnx
Title: VB version will not work, why   
Name: Dfour
Date: 2007-12-14 6:06:59 PM
Comment:
VB version will not work
Object reference not set to an instance of an object,
is killing me, i had to abanding this, I came back to it
still / anybody got the VB version working
Title: To give navigation URL from Table   
Name: Samir
Date: 2007-12-06 6:49:30 AM
Comment:
I want to give the navigation URL that is also stored in the database

How can I do this???
Title: Fantastic Article!!   
Name: Preetham
Date: 2007-12-05 10:48:57 PM
Comment:
great article! keep it up..this is what I was looking for. thanks
Title: menu control   
Name: Karthi
Date: 2007-11-27 6:40:24 AM
Comment:
If i use two table , i am getting an error Object reference not set to an instance of an object,there was a problem in data relation ..
can anybody tell that ..
here i am having two table name modulemst ,transmst
fields are moduleid ,ModuleNm,TransNm,TranId
Title: please send the doing for two table   
Name: karthickeyan
Date: 2007-11-27 6:30:10 AM
Comment:
please any body can send the coding two table .. the above example shows only one ..
Title: VB.Net Version   
Name: Chris Neeves
Date: 2007-11-23 2:34:26 PM
Comment:
\
Title: VB.Net Version   
Name: Chris Neeves
Date: 2007-11-23 2:32:55 PM
Comment:
\
Title: Nice one   
Name: Mahima
Date: 2007-11-21 2:40:13 AM
Comment:
I am new to .net & when i had to create a DB driven menu i thought its goind to be a tough job but your article was really nice & easy to understand.

Thanks

Happy Coding
Title: roles based security   
Name: shalan
Date: 2007-11-20 5:42:04 AM
Comment:
Hi,
Anyone got roles-based security working with this solution?
Title: menu bind   
Name: shahab
Date: 2007-10-27 3:45:02 AM
Comment:
tanx good article
it's works will
Title: Excellent   
Name: Kashif
Date: 2007-10-26 7:48:31 AM
Comment:
I got it to work fine with some little adjustments. Good code, thanks.
Title: Error to execute your project after download   
Name: Ayoub Jazayery
Date: 2007-10-22 3:04:55 AM
Comment:
Hi
after execute your project on VS 2005:
i saw the error:
"Circular reference in self-nested table 'Menu'."

please help me!
Best Regard
jazayery@gmail.com
Title: Getting Errror VB version also   
Name: Dfour
Date: 2007-10-18 2:49:37 PM
Comment:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +24
System.Xml.XmlDocument.Load(XmlReader reader) +96
System.Web.UI.WebControls.XmlDataSource.PopulateXmlDocument(XmlDocument document, CacheDependency& dataCacheDependency, CacheDependency& transformCacheDependency) +231
System.Web.UI.WebControls.XmlDataSource.GetXmlDocument() +154
System.Web.UI.WebControls.XmlHierarchicalDataSourceView.Select() +14
System.Web.UI.WebControls.Menu.DataBindItem(MenuItem item) +97
System.Web.UI.WebControls.Menu.PerformDataBinding() +117
System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect() +82
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.Menu.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.Menu.EnsureDataBound() +29
System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript) +21
System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e) +22
System.Web.UI.Control.PreRenderRecursiveInternal() +77
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
Title: Site Map   
Name: demis
Date: 2007-10-02 6:53:58 AM
Comment:
Can I use this for binding the sitemap..?
Thanks
Title: Object reference not set to an instance of an object.   
Name: demis
Date: 2007-10-02 4:19:46 AM
Comment:
I have the same problem with Saju...if anyone could help...thanks
Title: Object reference couldnot set   
Name: Saju
Date: 2007-09-08 7:46:40 AM
Comment:
I am getting an "Object reference not set to an instance of an object" error. how can i solve this problem, i converted code in to vb.net and it is creating the xmldatasource but still.....


thankx
Title: VB Version ????   
Name: Shalan
Date: 2007-08-30 2:57:17 AM
Comment:
Hi,

dos anyone please a working VB.net version of the above C# code? Ran it through a converter but I am getting an "Object reference not set to an instance of an object" error. All other files except code-behind are the same. Please would some kind soul help me out with this!

Thank u
Title: Reason for Circular Reference   
Name: Tinker
Date: 2007-08-20 10:11:05 AM
Comment:
Yes, it is a great tool, and my Circular Reference error seems to have been caused by trying to go 2 dynamic menus deep. When I removed the references back to the first dynamic menu, the error stopped. I was trying to do too much and pushing too far.

So a question: how do I create more than one dynamic menu using this tool?
Title: Also getting Circular reference in self-nested table   
Name: Tinker
Date: 2007-08-20 6:14:24 AM
Comment:
I'm trying to run this in prototype using an Access (2003) .mdb and am also getting the Circular reference error on the line "xmlDataSource.Data = ds.GetXml();". Googled the error message and all it returns is this page (Dhana's request/comment, below). Not sure how to debug an intentional Circular reference. Could use some advice.
Title: Nice   
Name: Parag Gupta
Date: 2007-07-27 3:51:46 AM
Comment:
It is really very helpfull artical.
Thanks.
Title: excellent article   
Name: Heba Hosny
Date: 2007-07-24 10:49:17 AM
Comment:
excellent article. Worked with me effortlessly. Thank you
Title: User Role Based Menu   
Name: Harpreet
Date: 2007-06-12 5:15:08 AM
Comment:
My Answer to Johan's Query:
Menu can be made role based using technique I used. Kindly read my comments titled : Menu Bar. Set the EnableCaching Property of XmlDataSource to false as guided by Michael.
My Answer to Sameer:
Set the EnableCaching Property of XmlDataSource to false as guided by Michael.
My Answer to Aishwarya:
Menu Control is not available in Dot Net 2003. If u have used the same in 2003, kindly tell me also. I shall be very thankful.
Thanx to KVR:
Thanks for replying to my query. All that was fine. I was using the same way as u explained. The thing was to set the EnableCaching property to false. Thanx again.
Rajesh:
Its working well with EnableCaching property set to false. But how were u saying? Could u please explain?
Title: Thanx to Michael Libby   
Name: Harpreet
Date: 2007-06-12 5:05:54 AM
Comment:
Michael,
Setting the EnableCaching property to false solves my problem. Thanx a lot.
Title: Need help   
Name: Srini
Date: 2007-05-29 11:00:44 AM
Comment:
For some reason, the menu is not correctly showing up in IE7. In Firefox it's working perfectly.

Any ideas please..
Title: Need Help   
Name: Piyush
Date: 2007-05-29 9:40:16 AM
Comment:
How can i view xml data that is stored in xmlDataSource.

Pls help!!
Title: Man this is primo   
Name: brett
Date: 2007-05-22 9:04:08 PM
Comment:
Good Work, so simple and cool!
Title: Need Help   
Name: Murali
Date: 2007-05-21 3:10:05 AM
Comment:
I tried with same code but i am getting blank menu, nothing is displaying, problem in DataBindings collections may be please help, i given settings also same, please help.
Title: need vb code   
Name: Curly
Date: 2007-05-17 2:31:46 AM
Comment:
cn any1 complie to vb code plz
Title: Menu   
Name: KVR
Date: 2007-05-09 7:29:19 PM
Comment:
Very Good article Mike.

Thank you.

I am answering Harpreet question. Inorder to make the menu role based, you can use the querry you have. Only thing you have to make sure is that access to the TOP Level menu for a child also is given. In your case If 4,5 are child nodes of 3 and 3 is a child node of 1 then 1, 3 also should be included into the list (ie 1, 3, 4, 5).

Hope this helps.

Thanks,
KVR
Title: Menu Control and SiteMap   
Name: V.S.Devipriya
Date: 2007-05-04 3:44:15 AM
Comment:
Hi,

Thank you. coding is working fine and good. Explain please tell me how can i bind the sitemap based on Menu Control.

Thank you
Title: User wise menus   
Name: Rajesh
Date: 2007-05-03 1:52:51 AM
Comment:
Harpreet,
Store the user wise menus on a different file
Create a view to access the data.
It works fine
Title: Thank you   
Name: Rajesh
Date: 2007-05-03 1:31:09 AM
Comment:
FANTASTIC ARTICLE Works like a GEM , Thanks a lot, Just the One I was looking for.
Title: Please help   
Name: Scott
Date: 2007-05-02 7:13:10 PM
Comment:
\S
\S
Title: Great Article   
Name: Harini Manda
Date: 2007-04-30 2:32:25 PM
Comment:
This is just what I was looking for! Thanks a bunch.
Title: Menu Bar   
Name: Harpreet
Date: 2007-04-27 5:56:48 AM
Comment:
Excellent article; This was what I was looking for, for a long long time. But one thing fails. Suppose, I change the query to fill dataset as

if user=user1(with some roles)
string sql = "Select MenuID,Text,Description,ParentID from Menu where MenuID in(1,2,3)";
else if user=user2(with some different roles)
string sql = "Select MenuID, Text,Description, ParentID from Menu where MenuID in(4,5)";

My sole purpose is to display some menu items to user1 and some other to user2. Then the xmldatasource is not bound correctly based on the query.
Title: Help   
Name: Dhana
Date: 2007-04-18 1:09:36 PM
Comment:
I am getting an error. Iam using c# 2005

System.Data.DataException: Circular Reference in Self-nested Table.

Please help me.

Thanks,
Dhana
Title: Useful article   
Name: Aishwarya
Date: 2007-04-07 4:37:49 AM
Comment:
Hi
The article is very good. I need to display menu items based on user login. Can i use the same in vb .net 2003 please help.
Title: navigation url problem   
Name: Rahul
Date: 2007-04-04 11:58:29 AM
Comment:
Dear Libby,
my problem is same like farah's comments(on 2/16/2007).plz
help me abt this matter as soon as possible.
I am requesting farah also,if u got solution share it.
e-mail:rahuldhip2002@yahoo.com
Title: More Needed   
Name: Paul Dipu
Date: 2007-04-04 11:44:13 AM
Comment:
Dear Libby,
A lot of thanks to u.it was fabulous job.But I need another things that is if I wanna add url in this menu what have to do more,plz write to me.
This article is only menu making and if I click just in menu shown description.
But I want to go new page when I click for that what have to do?
Waiting for ur reply
Title: I am having a problem   
Name: Sameer Goyal
Date: 2007-03-22 2:02:59 AM
Comment:
Hi,

The article is excellent, I must say. I tried implementing the same in my application and it worked just fine.
But I am facing an issue in the same. I have a requirement that the Menu Items are conditional, means for a 'Role' some items may or may not be available. BUt when I try to login in for the first time with Admin Role, that is elligible to see all menu items, it works fine. I try to log out and then login in with a diffrent role that should not see some Items, the Menu that appears is the same as for the Admin. After I clik on the menu link, the actual MEnu appears. Pls suggetsm
Title: Web Dev   
Name: Jarabud
Date: 2007-03-15 3:18:20 PM
Comment:
The sample works perfectly, but how do I make the bread crumb to work for this sample?. Please help!

Thank you,
Jarabud
Title: Perfact solution   
Name: Viraj Patel
Date: 2007-02-22 5:43:02 AM
Comment:
hi
i was looking for such solution...
it is just perfact..
Title: really helped me a lot.   
Name: .net developer
Date: 2007-02-20 4:47:40 PM
Comment:
Hi,
We have almost same requirement and i did follow urs it worked like magic.Thanks for the good article.
but my datasource is List<>. Now I have to modifiy the data accordingly. Hoping to see ur next article :)
Title: navigation url problem   
Name: farah
Date: 2007-02-16 1:16:25 AM
Comment:
i'm facing problem when i want to open a particular page against the link....for example i want to open product.aspx against product selection....how is it possible. i haved added a column url in my table, updated select command and set the value in xls file but i have not achived my goal ..please help me in this problem.
Title: wat about vs.net 2003 users   
Name: mik sang
Date: 2007-02-08 11:16:45 PM
Comment:
This is great help for .net 2005 users but wat about .net 2003 users.Can this be implemented using .net 2003 also?
Title: Like this i want for vb.net also   
Name: R.vinothKumar
Date: 2007-02-08 6:34:19 AM
Comment:
i want to create menu like this in vb.net if anybody have the coding like this ( menus with submenus loaded from database) please send it to me
Title: Pls Help me   
Name: rasi
Date: 2007-01-29 10:01:39 PM
Comment:
Hi,
Have downloaded the code and didn't change any coding but the code is displaying only the Menuitem. i think i missed something.pls guide me. is there anybody had the same problem?
Title: Building a Database Driven Hierarchical Menu using ASP.NET 2.0   
Name: Shivanand
Date: 2007-01-16 6:14:58 AM
Comment:
I was looking for this article. It's thoroughly explained.
Title: applied ur code   
Name: jack
Date: 2007-01-08 7:57:05 PM
Comment:
I tried ur menu application described above.but when I come to the line saying "if (Request.Params["Sel"] != null)"

I am always getting it as NULL.can u pls explain on this..I have all the code mentioned in r article and using sqlserver 2005..
Title: Error   
Name: Vítor
Date: 2006-12-08 8:43:31 AM
Comment:
There is an error in listing 2: MenuItemBindingDataMember must be replaced by MenuItemBinding DataMember...

[ ]s
Vítor
Title: Practical Menu Size Limitations?   
Name: Mike Russo
Date: 2006-12-05 2:47:22 PM
Comment:
I too tried using this technique with menu data coming from a database and had in total about 2500 menu items (it's not so hard to do - for instance a menu with ten level 0 items, ten level 1 items for each level 0 item, and ten level 2 items for each level 1 item will have 1110 items altogether). I was seeing times of 30 seconds to open a menu. It did not matter what level menu I was opening. Even just moving the mouse while hovering on the same menu item caused this delay in cursor response. I was also able to isolate the database query time from the rest of the menu processing and saw that perhaps 28 seconds was spent outside of the database query and XML generation. That leaves the client-side script that draws the menu from the XML data and mouse location. Does anyone know if Microsoft has recommended a maximum size of a menu hierarchy that the Menu control should be given??
Title: Re:Good One but giving me problem   
Name: Rajasekhar
Date: 2006-11-29 10:53:31 PM
Comment:
Hi Bhu !

May be the problem with the SP, i suppose.Try to tune it.for me also it is taking few seconds to load.but as iam using ajax,no freshes needed for menu.So only one time loading is enough.
Title: Good One but giving me problem   
Name: Bhu
Date: 2006-11-22 5:27:05 AM
Comment:
This sample very good which i looked for the long time.
But when i tried the same for my application it slow downs my system.. Why?
Is this bcoz of the recursion? I am using a dynamic 3 level where the datas will come for the database.

Plz reply me
Title: very useful to create a databse driven menu   
Name: R P Modi(india)
Date: 2006-11-20 1:48:55 AM
Comment:
the perfect solution to create a database driven menu
Title: "A child row has multiple parents."   
Name: Raj
Date: 2006-11-09 2:14:31 AM
Comment:
Hi Michale,
I got an exception while loading the menu.Exception is "A child row has multiple parents." I have a link "New Request" in two places.in the backend "New Request" comes twise with different parents.
How to resolve this issue? I cant give different names to two links.

Pls reply me asap.
Thanks in advance.
Title: Roles?   
Name: Johan
Date: 2006-11-07 10:53:01 AM
Comment:
How can I implement roles to this great menu.
Title: customizing the menu   
Name: swapnil
Date: 2006-11-01 5:49:23 AM
Comment:
hello, now i want to give the effects to the menu.
how can i customize the menu and how can i set the opacity of that menu.
Title: Problem when embedding to my Table   
Name: kunal_mehta_1983@yahoo.com
Date: 2006-10-17 2:54:56 AM
Comment:
When I embedd with my table i get error

***************************************************
The specified node cannot be inserted as the valid child of this node, because the specified node is the wrong type.

***************************************************

The table structure is same only the zero is using for parent instead of NULL

Please tell me what is the problem and can you please provide me code in Vb.net
Title: Stuck with event   
Name: Jackbee
Date: 2006-09-29 11:18:56 PM
Comment:
Using Your article , I can not capture the events when menu item's clicked , how can i solve this problem ?
Title: One Doubt: Menu Binding Everytime, whenever new page loads   
Name: A.Karthikeyan
Date: 2006-09-20 1:38:57 AM
Comment:
Sir,

Your article was very useful to me. For a web application,I am using similar method to bind a menu that displays in everypage.

The stored procedure that is used to retrieve the menu items is executed everytime when a new page loads and thus overall performance goes down. ( Sp is used to join three tables and to retrieve the values in a parent-child format)

I have used the menu as usercontrol to load at everypage.
In the code-behind of usercontrol, i have called the stored procedure to retrieve menu items...

Can we use session-like concepts to bind the menu only once at the beginning...?
Title: please respond   
Name: Vishal Koul
Date: 2006-09-07 2:25:25 AM
Comment:
Dear Timmy,

You have not responded to my query of having cross frame menu. I will repeat my problem and that is if i have 2 frames in my site and if i put this menu in header frame then all menu items are overlapped by below detail frame.
Do you have a solution for this???

Please reply ASAP as it is very urgently required.
Title: Fantastic Solution   
Name: Justin Wilson
Date: 2006-08-26 2:25:15 PM
Comment:
This is a fantastic artical. I am also using privilge baised menu's and didn't know about the EnableCaching property. Once I found that everything worked perfectly. I could have used this years ago. Do you know of anyway not to have a grafic or arrow when a menu has child menu's?
And I would love more of your articles.
Title: Developer   
Name: Vik
Date: 2006-08-17 1:55:59 AM
Comment:
Nice Article .Helped me to understand very clearly on what i need to do for my menu.. Thank you
Title: Web.sitemap   
Name: Sulaiman Agha
Date: 2006-08-07 1:09:17 AM
Comment:
The xml format that is resulted after applying xsl. This format doesnt need to match the same format which is in the Web.sitemap. If no why not and can I define my own xml menu format and apply it to the Menu web control
Thank you for your example
Title: RE: Same items in Menu Control been displayed   
Name: Vikas K
Date: 2006-08-01 10:03:17 AM
Comment:
Thanks a ton Micheal,

This is solved and working.........i just set it to false....

But don't u think, this is weird....By default, it should be FALSE..........

Thanks once again......

Cheers
Vikas
Title: Good Work   
Name: Jasdeep
Date: 2006-08-01 3:12:52 AM
Comment:
That's a real good 1...
Title: RE: Same items in Menu Control been displayed   
Name: Michael Libby
Date: 2006-07-31 5:03:00 PM
Comment:
Try setting the XmlDataSource objects EnableCaching property to false.
Title: Same items in Menu Control been displayed   
Name: Vikas K
Date: 2006-07-31 2:12:18 PM
Comment:
Hi,

I have used the exact code as mentioned above..I have implemented this for Roles Management in ASP.NET 2.0..I am retreiving all the privileges in a dataset and then binding it to XMLDatasorce..But, sometimes I get the old values in the menu control.......i have a login page, from where depending on the user , the menu items are displayed.....sometimes it works fine and sometimes it shows old values........i have cheked everything.....i m not using session variables.......using querystrings to pass user details for test project....Can XSL have the caching problem, coz rest i have verifies..Can u help me with this?
Title: MenuItems always first   
Name: Coburn
Date: 2006-07-26 1:56:48 PM
Comment:
I just needed to set the xpath attribute of the xsmldatasource
Title: MenuItems always first   
Name: Coburn
Date: 2006-07-26 1:15:56 PM
Comment:
Greate article I search google for a day looking to be able to do exactly this. Good job. The only problem I have is tht "MenuItems" always appears at the first menu option then my root option and nodes. I see in the example that "Products" shows first. How do I elminate MenuItem from showing.
Title: RE: Lost at Navigation   
Name: Tim Sun
Date: 2006-07-18 1:49:50 AM
Comment:
and remember to edit your SQL select string too.
Title: RE: Lost at Navigation   
Name: Tim Sun
Date: 2006-07-18 1:34:08 AM
Comment:
RE: Lost at Navigation
If you add a column named "Url" in database then you must edit the xml file from
〈xsl:attribute name="NavigateUrl"〉
〈xsl:text〉?Sel=〈/xsl:text〉
〈xsl:value-of select="Text"/〉
to
〈xsl:attribute name="NavigateUrl"〉
〈xsl:text〉?Sel=〈/xsl:text〉
〈xsl:value-of select="Url"/〉
that it all.
Title: Building a Database Driven Hierarchical Menu using ASP.NET 2.0   
Name: Tim Sun
Date: 2006-07-17 12:56:25 PM
Comment:
I like this sample, but I also need the Menu items can be built according to the user authorization.
How can I do this?
Title: Cross Frame Problem   
Name: Vishal Koul
Date: 2006-07-11 5:11:36 AM
Comment:
The solution provide and description is excellent but I am facing the cross frame problem as I want to keep menu in one frame and and the target links in another frame. Now Here come the glitch, the menu if larger than the parent frame size is hiding below the other frame. Is there any solution for cross frame scenario. Please revert back urgently.
Title: RE: Lost at Navigation   
Name: Susan
Date: 2006-07-06 9:36:13 AM
Comment:
The difficult thing about articles is that they cannot meet all scenarios. This article is nicely written, however it is based on the assumption that a single URL with params will be used, i.e. default.aspx?sel=1. This is typical of portal and more advanced web apps. If this is not your scenario, You can easily extrapolate from the logic in this article to add NavigateUrl to the database and XSLT logic to acheive your results.
Title: Lost at Navigation   
Name: Laserman
Date: 2006-07-05 12:18:58 PM
Comment:
I'mlost at the navigation part.
How do you get the Navigate="?SEL=" for each menu item?

SUppose as a test I wanted Document-Tutorials to go to
www.yahoo.com, how do i set that up?

laserman
Title: Building a Database Driven Hierarchical Menu using ASP.NET 2.0   
Name: beerinder
Date: 2006-06-06 12:51:06 PM
Comment:
This has solved my problemn more efficiently than i would have ever imagined . Thank you very much Libby . You are exceptional . waiting 2 see your next article.
Title: in ASP.net 1.1???   
Name: pranay shetty
Date: 2006-05-23 3:12:16 AM
Comment:
neat piece.. but anyway to implement somethin similar in ASP.net 1.1 using VS .net 2003 . the menu control isnt there here to be dragged and dropped .. will it work if i directly code in the menu like in listing 2.
Title: Great article   
Name: Peter Larsson
Date: 2006-05-20 3:23:50 PM
Comment:
Good job writing this quite complex setup in a simple way. Just what I needed, I owe you one! ;)

/Peter Larsson
Title: Sorry   
Name: Dan
Date: 2006-05-09 12:39:20 PM
Comment:
missed the data bindings in the control.... works well. I have the vb flavor if anyone needs it. dan@1stguard.com
Title: Missed Somthing   
Name: Dan
Date: 2006-05-09 12:32:07 PM
Comment:
The number of and relations of the menus are showing up, but they all say 'MenuItem' so I missed something... any ideas?
Title: Re: What about Roles in the menu?   
Name: Michael Libby
Date: 2006-05-08 8:54:47 AM
Comment:
Role based security will be implemented in the next article which will build upon this article. My article goal is to show complex functionality within just a few lines of code. I've almost got my next article to this point which includes Microsoft's role based security, a SQLProvider, and change notification. Keep checking back.
Title: What about Roles in the menu?   
Name: Girogio
Date: 2006-05-08 8:39:17 AM
Comment:
It looks a great article but it misses a very important point which is "Roles". That would allow to show menu items depending on who the user is.
Title: Building a Database Driven Hierarchical Menu using ASP.NET 2.   
Name: Scottt40
Date: 2006-05-08 6:48:09 AM
Comment:
Nice job on the article. I had to rewrite your implementation of the URL which was easy enough.
Title: good combination of techniques   
Name: dot net follower
Date: 2006-05-06 5:25:41 PM
Comment:
short program, cover a lot of bases. terrific work. keep it up
Title: Menus   
Name: Steve
Date: 2006-05-06 9:34:53 AM
Comment:
Thank you very much - this is a great article.

Are there any issues with creating the xml file everytime someone hits the website as far as reading/writing and locking? ie. user one is reading the xml, user two is in the act of creating the same xml file on his subsequent page hit.
Title: Great Article!   
Name: Yuki
Date: 2006-05-05 11:08:24 PM
Comment:
Thank you for a great article! Looking forward to seeing the next article and maybe another article that will expand this one to enable security trimming based on user roles...
Title: Consultant   
Name: Byron Peterson
Date: 2006-05-05 11:36:16 AM
Comment:
I am wondering - the menu control has the option to have horizontal orientation. However, is it possible for sub-menus to also have horizontal orientation so that, effectively, you'd have a hierarchical tabstrip?
Title: Great Solution   
Name: Pelr Sadu (India)
Date: 2006-05-05 6:04:51 AM
Comment:
I first implemented Jess Prosise's solution but replaced it with yours which is a MUCH simplier design. Thank you, I'm also waiting for your next article.
Title: Exactly what i was looking for   
Name: Sunny Zandro
Date: 2006-05-04 10:23:10 PM
Comment:
This is great! Exactly what i was looking for, in fact i was going to implement the same thing same style... it just saved me a lot of time now :)
Title: Waiting For Your Next Article   
Name: Sue Bennit
Date: 2006-05-04 2:19:59 PM
Comment:
That worked like a charm. When is the next article due out?
Title: Practical Menu Solution!   
Name: Sue Bennit
Date: 2006-05-04 2:15:25 PM
Comment:
Keep up the good work.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-19 6:51:19 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search