Đang chuẩn bị liên kết để tải về tài liệu:
Professional ASP.NET 3.5 in C# and Visual Basic Part 52

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

Professional ASP.NET 3.5 in C# and Visual Basic Part 52. Building on the revolutionary ASP.NET 2.0 release, ASP.NET 3.5 adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in ASP.NET 2.0 now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 9 Querying with LINQ Next the code uses a very simple LINQ query to select all of the Movie objects from the generic movies collection. Notice that this specific LINQ query utilizes new language keywords like from and select in the query statement. These syntax additions are first class members of the .NET languages therefore Visual Studio 2008 can offer you development assistance such as strong type checking and IntelliSense making it easier for you to find and fix problems in your code. The query also defines a new variable m. This variable is used in two ways in the query. First by defining it in the from statement from m we are telling LINQ to make m represent the individual collection item which in this case is a Movie object. Telling LINQ this enables it to understand the structure of the objects we are querying and as you will see later also gives us IntelliSense to help create the query. The second use of m in the query is in the select statement. Using m in the select statement tells LINQ to output a projection that matches the structure of m. In this case that means LINQ creates a projection that matches the Movie object structure. We could just have easily created our own custom projection by explicitly defining the fields we wanted returned from the query using the new keyword along with the select operator. This is shown below in Listing 9-7. Listing 9-7 Creating a custom projection with LINQ VB Protected Sub Page_Load ByVal sender As Object ByVal e As System.EventArgs Dim movies GetMovies Dim query From m In movies _ Select New With m.Title m.Genre Me.GridViewl.DataSource query Me.GridView1.DataBind End Sub C protected void Page_Load object sender EventArgs e var movies GetMovies var query from m in movies select new m.Title m.Genre this.GridViewl.DataSource query this.GridView1.DataBind Notice that rather than simply selecting m we have defined a new projection containing only the Title and Genre values. You can even go so far as to .

TÀI LIỆU LIÊN QUAN
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.