TAILIEUCHUNG - ASP.NET 4 Unleased - p 106

Using the Navigation Controls The page includes a MenuItemClick event handler. When you click a MenuItem (and the MenuItem does not have a NavigateUrl property), the MenuItemClick event is raised. In Listing , the MenuItemClick handler displays the value of the selected MenuItem in a Label control. Using the Menu Control with the MultiView Control When the Menu control is used with the MultiView control, you can create tabbed pages. You use the Menu control to | 1024 CHAPTER 22 Using the Navigation Controls asp Menu id Menu1 OnMenuItemClick Menu1_MenuItemClick Runat server Items asp MenuItem Text Products Page Value Products asp MenuItem Text Services Page Value Services asp MenuItem Text Training Page Value Training asp MenuItem Text Consulting Page Value Consulting asp MenuItem Items asp Menu hr asp Label id lblMessage EnableViewState false Runat server div form body html The page includes a MenuItemClick event handler. When you click a Menuitem and the Menuitem does not have a NavigateUrl property the MenuItemClick event is raised. In Listing the MenuItemClick handler displays the value of the selected Menuitem in a Label control. Using the Menu Control with the MultiView Control When the Menu control is used with the MultiView control you can create tabbed pages. You use the Menu control to display the tabs and the MultiView control to display the content that corresponds to the selected tab. For example the page in Listing displays three tabs see Figure . From the Library of Wow eBook Using the Menu Control 1025 FIGURE Displaying a tabbed page. LISTING 22 @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML EN http TR xhtml11 DTD script runat server protected void menuTabs_MenuItemClick object sender MenuEventArgs e script html xmlns http 1999 xhtml head id Head1 runat server style type text css html background-color silver .menuTabs position relative top 1px From the Library of Wow eBook 1026 CHAPTER 22 Using the Navigation Controls left 10px .tab border Solid 1px black border-bottom none padding 0px 10px background-color eeeeee .selectedTab border Solid 1px black border-bottom Solid 1px white padding 0px 10px background-color white .tabBody border Solid 1px black padding 20px background-color white style title Menu Tab Strip title head body form id form1 runat server div asp