tailieunhanh - ASP.NET 1.1 Insider Solutions- P4
Tham khảo tài liệu ' insider solutions- p4', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 138 4 Working with Nested List Controls LISTING Continued ItemTemplate _ Freight 0 f2 ItemTemplate EditItemTemplate asp TextBox Columns 3 id txtFreight runat server Text Freight EditItemTemplate asp TemplateColumn asp BoundColumn DataField ShipperName HeaderText Via ReadOnly True Columns asp DataGrid SelectedItemTemplate FooterTemplate nbsp FooterTemplate asp DataList The Important Points of the DataList Control Declaration The DataList control displays the list of customers and you add to it three attributes that control its behavior in terms of viewing the order list for each customer. You set the DataKeyField attribute to the CustomerID column in the source row set so that you can easily get the ID of the customer for the current row DataKeyField CustomerID You also specify the names of two event handlers. The routine named DoItemSelect will be executed when any control within the DataList control causes a postback and the routine named BindOrdersGrid will be executed each time a row in the DataList control is bound to its source data OnItemCommand DoItemSelect OnItemDataBound BindOrdersGrid The DataList control declaration uses a header and a footer row to achieve the appearance of the dark bands above and below the list with the header containing just the plain text Customer List and the footer containing a nonbreaking space character nbsp to preserve the row height. A Master Detail Display with DataList and DataGrid Controls 139 In the ItemTemplate section you use an ImageButton control to generate the drop-down button. The declaration of the ImageButton control sets CommandName to Select this value is used to detect whether the ImageButton button was clicked when the ItemCommand event was raised. You also specify the image file for the button in the images subfolder of the application root the size and the alternate text that will provide the pop-up ToolTip asp ImageButton CommandName Select ImageUrl
đang nạp các trang xem trước