TAILIEUCHUNG - ASP.NET 4 Unleased - p 61

Khi bạn mở trang trong 12,4 Ví dụ, nội dung của các hiển thị hữu EmptyDataText. Nếu bạn cần hiển thị nhiều nội dung phức tạp khi không có kết quả được trả về, chẳng hạn như các điều khiển , bạn có thể chỉ định một | 574 CHAPTER 12 Using the DetailsView and FormView Controls 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 title Show Empty Data Text title head body form id form1 runat server div asp DetailsView id dtlMovies DataSourceID srcMovies EmptyDataText b No Matching Record b Runat server asp SqlDataSource id srcMovies ConnectionString ConnectionStrings Movies SelectCommand SELECT Id Title Director InTheaters FROM Movies WHERE Id -1 Runat server div form body html When you open the page in Listing the contents of the EmptyDataText property display. If you need to display more complicated content when no results are returned such as controls you can specify an EmptyDataTemplate. The page in Listing illustrates how you can use the EmptyDataTemplate to display complicated HTML content see Figure . From the Library of Wow eBook Using the DetailsView Control 575 FIGURE Displaying content when no results are returned. 12 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 .noMatch background-color ffff66 padding 10px font-family Arial Sans-Serif .noMatch h1 color red font-size 16px font-weight bold style title Show Empty Data Template title From the Library of Wow eBook 576 CHAPTER 12 Using the DetailsView and FormView Controls head body form id form1 runat server div asp DetailsView id dtlMovies DataSourceID srcMovies Runat server EmptyDataTemplate div class noMatch h1 No Matching Results h1 Please select a different record. div EmptyDataTemplate asp DetailsView asp SqlDataSource id srcMovies ConnectionString ConnectionStrings Movies SelectCommand SELECT Id Title Director InTheaters FROM Movies WHERE Id -1 Runat server .

Đã 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.