TAILIEUCHUNG - ASP.NET 4.0 in Practice phần 4

Như bạn thấy, mã không phải là phức tạp, nhưng nó đòi hỏi rằng bạn hiểu như thế nào DataList (và điều khiển mẫu). Để hoàn thành kịch bản, chúng ta cần để cho bạn thấy làm thế nào để làm cho tiêu đề (footer). Các danh sách sau đây có chứa mã. | TECHNIQUE 32 The first application 125 private static MetaModel s_defaultModel new MetaModel public static MetaModel DefaultModel get return s_defaultModel public static void RegisterRoutes RouteCollection routes ContextConfiguration config new ContextConfiguration ScaffoldAllTables true typeof NorthwindEntities config VB Public Class Global Inherits Private Shared s_defaultModel As New MetaModel Public Shared ReadOnly Property DefaultModel As MetaModel Get Return s_defaultModel End Get End Property Public Shared Sub RegisterRoutes ByVal routes As RouteCollection Dim config As New ContextConfiguration True -- Shows all tables GetType NorthwindEntities -- ObjectContext config End Sub End Class In this example we re using Entity Framework but with LINQ to SQL both the code and the concepts are identical. The ScaffoldAllTables property is important because by default its value is false. By setting it to true you ll automatically show all the tables in the first page. When you create a new application based on this project you ll notice that all the code is already in place and you don t need to write it A new route is also registered C new DynamicDataRoute table action .aspx Constraints new RouteValueDictionary new action List Details Edit Insert Model DefaultModel VB New DynamicDataRoute table action .aspx With .Constraints New RouteValueDictionary New With 126 Chapter 5 Data binding in Web Forms .Action List Details Edit lnsert .Model DefaultModel Dynamic Data controls work with a friendly URL such as Products . You can change the generated URL to reflect your needs. You can protect these URLs using standard authorization and authentication features from such as UrlAutho-rization and FormsAuthentication. When you re running the project you ll receive a list of tables shown in figure . If you navigate to each

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.