Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 107

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Việc kiểm soát Menu bao gồm một phần tử . Nguyên tố này bao gồm hai subtags MenuItemBinding. Các subtag đầu tiên đại diện cho mối quan hệ giữa các nút thể loại trong tập tin XML và | 1034 CHAPTER 22 Using the Navigation Controls LISTING 22.13 MenuXMLComplex.aspx @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML 1.1 EN http www.w3.org TR xhtml11 DTD xhtml11.dtd html xmlns http www.w3.org 1999 xhtml head id Head1 runat server title Menu XML Complex title head body form id form1 runat server div asp Menu id Menu1 DataSourceID srcMenu Runat server DataBindings asp MenuItemBinding DataMember category TextField text asp MenuItemBinding DataMember item TextField text ValueField price DataBindings asp Menu asp XmlDataSource id srcMenu DataFile MenuComplex.xml Runat server div form body html The Menu control includes a DataBindings element. This element includes two MenultemBinding subtags. The first subtag represents the relationship between the category nodes in the XML file and the menu items. The second subtag represents the relationship between the item nodes in the XML file and the menu items. From the Library of Wow eBook Using the Menu Control 1035 Binding to Database Data You can t bind a Menu control directly to database data. Neither the SqlDataSource nor ObjectDataSource controls implement the IHierachicalDataSource interface. Therefore if you want to represent database data with the Menu control you need to perform some more work. One option is to create your own SqlHiearachicalDataSource control. You can do this either by deriving from the base HiearchicalDataSourceControl class or implementing the IHiearchicalDataSource interface. You take this approach in the final section of this chapter when a custom SqlHierarchicalDataSource control is built. A second option is to build the menu items programmatically in the Menu control. This is the approach followed here. Imagine that you want to represent the contents of the following database table with a Menu control 22 Categoryld ParentId Name 1 null Beverages 2 null Fruit 3 1 Milk 4 1 Juice 5 4 Apple Juice 6 4 Orange Juice 7 2 Apples 8 2 Pears This database table represents product .

TÀI LIỆU LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.