TAILIEUCHUNG - ASP.NET 4 Unleased - p 111

CHAPTER 22 Using the Navigation Controls . RootNodeStyle—Applied to root nodes (Tree nodes with no parent nodes). . SelectedNodeStyle—Applied to the selected node. For example, the page in Listing uses several of these Style objects to format a TreeView control (see Figure ). FIGURE Using Styles with the TreeView control. LISTING .treeNode { color:blue; font:14px Arial, Sans-Serif; } .rootNode { font-size:18px; width:100%; border-bottom:Solid 1px black; From the Library of Wow! eBook Using the TreeView Control 1075 } .leafNode { border:Dotted 2px black; padding:4px; background-color:#eeeeee; font-weight:bold; } TreeView Styles . | 1074 CHAPTER 22 Using the Navigation Controls RootNodeStyle Applied to root nodes Tree nodes with no parent nodes . SelectedNodeStyle Applied to the selected node. For example the page in Listing uses several of these Style objects to format a TreeView control see Figure . FIGURE Using Styles with the TreeView control. LISTING @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML EN http TR xhtml11 DTD html xmlns http 1999 xhtml head id Head1 runat server style type text css .treeNode color blue font 14px Arial Sans-Serif .rootNode font-size 18px width 100 border-bottom Solid 1px black From the Library of Wow eBook Using the TreeView Control 1075 .leafNode border Dotted 2px black padding 4px background-color eeeeee font-weight bold style title TreeView Styles title head body form id form1 runat server div asp TreeView id TreeView1 NodeStyle-CssClass treeNode RootNodeStyle-CssClass rootNode LeafNodeStyle-CssClass leafNode Runat server Nodes asp TreeNode Text Home asp TreeNode Text Products asp TreeNode Text First Product asp TreeNode Text Second Product asp TreeNode asp TreeNode Text Services asp TreeNode Text First Service asp TreeNode Text Second Service asp TreeNode asp TreeNode Nodes asp TreeView div form body html 22 Furthermore you can apply styles to particular Tree node levels by taking advantage of the TreeView control s Levelstyles property. The page in Listing uses the Levelstyles property to format first level nodes differently than second level nodes and third level nodes see Figure . From the Library of Wow eBook 1076 CHAPTER 22 Using the Navigation Controls FIGURE Applying styles to different TreeView node levels. LISTING @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML EN http TR xhtml11 DTD html xmlns http 1999 xhtml head id Head1 runat server style type text css .nodeLevel1 .