Creating Menu using ASP.NET and XMLIf 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.
|
|
|||
|
||||
“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”
Copyright - © 2004 - 2019 - All Rights Reserved.