Creating Menu using ASP.NET and XML

If you know how to transform an xml document using an xsl style sheet then it is easy to display the menu with the data that is taken from the xml document.

To create a menu using Asp.Net, you have to create an xml document first. The xml document has to have the items for the menu in an order with provision for the sub menus. After creating this you have to create an xsl stylesheet that is used to transform the xml data into a menu.

In the xsl stylesheet use the XPath to get child nodes of a specific node. The items that are looped like this should be placed in a table and this table has to be placed within a div layer.

After creating such a div layer in the style sheet, you have to create some Javascript code that will hide or show the layers when the user clicks that particular div. You can also use code to change the background when the mouse hovers over the menu item.

Once such an xsl stylesheet is created for the xml file, you can use the XmlDocument object in ASP.Net to create and load the xml file. Similarly create an XslTransform object to load the xsl file. Use the Transform method to transform the xml file into an html that displays the menu.

Instead of using such code to transform, you can also do this in design time by dragging an xml server control to the aspx page and assigning the DocumentSource property to the xml document and the TransformSource property to the xsl document.



.

SetApp - 100 Apps for everything you ever wanted to do on Mac

FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

_______________________________________







 

 

FREE Subscription

Stay Current With the Latest Technology Developments Realted to XML. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.

 

 

Add to My Yahoo!

Visit XML Training Material Guide Homepage

 

 

“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

Copyright - © 2004 - 2019 - All Rights Reserved.