![]() ![]() To display static menu items using declarative syntax, first nest opening and closing tags between the opening and closing tags of the Menu control. The simplest data model of the Menu control is static menu items. You can also optionally display an image in a menu item by setting the ImageUrl property.įor more information on menu items, see MenuItem. If the NavigateUrl property is not set for a menu item, the Menu control simply submits the page to the server for processing when the menu item is clicked. When clicked, a menu item can navigate to another Web page indicated by the NavigateUrl property. The value of the Text property is displayed in the Menu control, while the Value property is used to store any additional data about the menu item, such as data passed to the postback event associated with the menu item. Child menu items are stored in a parent menu item's ChildItems collection.Įach menu item has a Text and a Value property. All root menu items are stored in the Items collection. A menu item that has a parent menu item is called a child menu item. Menu items at the top level (level 0) are called root menu items. For more information, see UpdatePanel Control Overview and Partial-Page Rendering Overview.Ī Menu control is made up of a tree of menu items represented by MenuItem objects. UpdatePanel controls are used to update selected regions of a page instead of updating the whole page with a postback. You can add the Menu control only to a page outside an UpdatePanel control. The Menu control is not designed to be used inside an UpdatePanel control. To display the linked content in a different window or frame, use the Target property of the Menu control. By default, a linked page is displayed in the same window or frame as the Menu control. If the NavigateUrl property of a menu item is set, the Menu control navigates to the linked page otherwise, it posts the page back to the server for processing. When the user clicks a menu item, the Menu control can either navigate to a linked Web page or simply post back to the server. Programmatic access to the Menu object model to dynamically create menus, populate menu items, set properties, and so on.Ĭustomizable appearance through themes, user-defined images, styles, and user-defined templates. ![]() Site navigation through integration with the SiteMapDataSource control. The Menu control supports the following features:ĭata binding that allows the control's menu items to be bound to hierarchal data sources. The Menu control is used to display a menu in an ASP.NET Web page and is often used in combination with a SiteMapDataSource control for navigating a Web site. The following is sample site map data for the previous example. For this example to work correctly, you must copy the sample site map data below to a file named Web.sitemap. ![]() The following code example demonstrates how to bind the Menu control to a SiteMapDataSource control. The following code example demonstrates how to create a Menu control with static menu items using declarative syntax. INamingContainer IPostBackEventHandler ExamplesĪ Visual Studio Web site project with source code is available to accompany this topic: Download. ![]()
0 Comments
Leave a Reply. |