TAILIEUCHUNG - ASP.NET 4 Unleased - p 109

Hiển thị Kiểm tra hộp với các Control TreeView Bạn có thể hiển thị các hộp kiểm bên cạnh mỗi nút điều khiển TreeView bằng cách chỉ định một giá trị tài sản ShowCheckBoxes. tài sản này chấp nhận các giá trị sau:. Tất cả. Lá. Không có. Phụ Huynh. | 1054 CHAPTER 22 Using the Navigation Controls div class content You selected asp Label id lblMessage EnableViewState false Runat server div form body html The page in Listing includes a SelectedNodeChanged event handler. When you select a new node the SelectedNodeChanged event handler displays the value of the selected TreeNode in a Label control. Displaying Check Boxes with the TreeView Control You can display check boxes next to each node in a TreeView control by assigning a value to the ShowCheckBoxes property. This property accepts the following values All Leaf None Parent Root You can use a bitwise combination of these values when specifying the nodes to display with check boxes. The page in Listing illustrates the ShowCheckBoxes property see Figure . From the Library of Wow eBook Using the TreeView Control 1055 FIGURE Displaying TreeView check boxes. LISTING 22 @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML EN http TR xhtml11 DTD script runat server protected void btnSubscribe_Click object sender EventArgs e foreach TreeNode node in script html xmlns http 1999 xhtml head id Head1 runat server title TreeView CheckBoxes title head body form id form1 runat server div From the Library of Wow eBook 1056 CHAPTER 22 Using the Navigation Controls Select the Newsgroups which you would like to join br asp TreeView id TreeView1 ShowCheckBoxes Leaf Runat server Nodes asp TreeNode Text Programming asp TreeNode Text asp TreeNode Text JAVA asp TreeNode Text Cold Fusion asp TreeNode asp TreeNode Text Sports asp TreeNode Text Baseball asp TreeNode Text Hockey asp TreeNode Text Football asp TreeNode Nodes asp TreeView br asp Button id btnSubscribe Text Subscribe OnClick btnSubscribe_Click Runat server hr You selected asp BulletedList id bltSubscribed EnableViewState false Runat server div form body html From the .