Create a Simple, Cross-Browser, Dropdown Menu User Control with C#
(Page 1 of 5 )
In this article, Nick Howard will demonstrate the use of an ASP.NET user control coded in C#. In order to accomplish this task, a variety of technologies will be utilized including XML, XSL/XSLT, CSS and JavaScript.Every web site or intranet application needs some form of navigation device. Often you will see static links to subordinate pages that need to be included on each and every page of a site. When you are dealing with a site of modest proportion, this method of inclusion may be adequate. If a menu change needs to be made, only a handful of pages need to be edited and updated. When your site starts to become a little more unwieldy, as your page count increases or your navigation becomes more complex, this method of upkeep starts to become a more difficult undertaking.
Even when I was developing DOS-based applications, the first course of action included the development of a reusable menu control that could be easily ported between the different apps we were developing. (This included peeking into screen memory, saving the current contents and swapping in the menu text.) Now with the Internet, the need is the same, if not greater, due to the dynamic nature of the web itself. Therefore, a dynamic, flexible, extensible
and easy-to-use method of displaying menu text is a bare necessity. In this article, you will see an example of the design, development and deployment of a horizontal dropdown menu user control.
System Requirements The menu control was developed using the .NET Framework version 1.0.3705 (version 1.0 is available at
http://www.microsoft.com/downloads/details.aspx?familyid=d7158dee-a83f-4e21-b05a-009d06457787), a text editor (my favorite is TextPad), Microsoft Internet Explorer Version 6.0 (although the menu is compatible with IE 4.0 and above), Netscape Version 4.72 (layers) and Netscape 6.2.
You should be familiar with ASP.NET, C# or VB.NET (see code download for a VB.NET version), XML, XSL/XSLT, CSS and JavaScript. If you are not comfortable with any of these technologies, this example should help you get started (it's got a little bit of everything).
Next: What are ASP.NET User Controls? >>
More ASP.NET Articles
More By Wrox Team