<%@ Page Language="C#" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <script runat="server"> protected override void OnLoad(EventArgs e) { base.OnLoad(e); DirectoryInfo d = new DirectoryInfo(Server.MapPath("~/")); MenuItem root = new MenuItem("\\", d.FullName); this.AddChildren(root, d); this.menuNavigation.Items.Add(root); } private void AddChildren(MenuItem item, DirectoryInfo direcotry) { foreach (DirectoryInfo child in direcotry.GetDirectories()) { MenuItem childItem = new MenuItem(child.Name, child.FullName); item.ChildItems.Add(childItem); if (child.GetDirectories().Count() > 0) this.AddChildren(childItem, child); } foreach (FileInfo child in direcotry.GetFiles()) { MenuItem childNode = new MenuItem(child.Name, child.FullName); item.ChildItems.Add(childNode); } } </script> </head> <body> <form id="form1" runat="server"> <asp:Menu runat="server" ID="menuNavigation" /> </form> </body> </html>
Thursday, August 26, 2010
How to list all the directories and files in to a asp.net menu
Subscribe to:
Post Comments (Atom)
Azure Storage Account Types
Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...
-
Why we need asynchronous tasks? Execute a time consuming operations in parallel to the CLR thread which execute the request If you have ...
-
Demo: I was thinking a way to show images before actually uploading them to server. I would say to preview images using javascript. Obv...
No comments:
Post a Comment