TAILIEUCHUNG - ASP.NET 4 Unleased - p 66

Sử dụng điều khiển Repeater và DataList Hiển thị dữ liệu với các điều khiển Repeater Để hiển thị dữ liệu với các điều khiển Repeater, bạn phải tạo một ItemTemplate. Ví dụ, các trang trong Ví dụ 13,1 hiển thị nội dung của bảng cơ sở dữ liệu phim (xem Hình ). | 624 CHAPTER 13 Using the Repeater and DataList Controls Displaying Data with the Repeater Control To display data with the Repeater control you must create an ItemTemplate. For example the page in Listing displays the contents of the Movies database table see Figure . FIGURE Displaying data with a Repeater 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 html background-color silver .content width 6O0px border solid 1px black background-color eeeeee From the Library of Wow eBook Using the Repeater Control 625 .movies margin 20px 10px padding 10px border dashed 2px black background-color white style title Show Repeater title head body form id form1 runat server div class content 13 asp Repeater id rptMovies DataSourceID srcMovies Runat server ItemTemplate div class movies h1 Eval Title h1 b Directed by b Eval Director br b Box Office Totals b Eval BoxOfficeTotals 0 c div ItemTemplate asp Repeater asp SqlDataSource id srcMovies ConnectionString SelectCommand SELECT FROM Movies Runat server ConnectionStrings Movies Title Director BoxOfficeTotals div form body html The Repeater control in Listing displays each record in a separate HTML div tag. A databinding expression is used to display the value of each column. In Listing declarative databinding is used to bind the Repeater to the SqlDataSource. You also can databind a Repeater control programmatically. From the Library of Wow eBook 626 CHAPTER 13 Using the Repeater and DataList Controls For example the page in Listing contains a Repeater control that renders a JavaScript array. The Repeater control is programmatically databound to the list of files in the Photos directory. LISTING @ Page Language C @ Import Namespace DOCTYPE html PUBLIC - W3C DTD XHTML EN http .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.