Professional ASP.NET 3.5 in C# and Visual Basic Part 51

Professional in C# and Visual Basic Part 51. Building on the revolutionary release, 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 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 Listing 9-1 A basic Movie class VB Imports Public Class Movie Private _title As String Private _director As String Private _genre As Integer Private _runtime As Integer Private _releasedate As DateTime Public Property Title As String Get Return _title End Get Set ByVal value As String _title value End Set End Property Public Property Director As String Get Return _director End Get Set ByVal value As String _director value End Set End Property Public Property Genre As Integer Get Return _genre End Get Set ByVal value As Integer _genre value End Set End Property Public Property Runtime As Integer Get Return _runtime End Get Set ByVal value As Integer _runtime value End Set End Property Public Property ReleaseDate As DateTime Get Return _releasedate End Get Set ByVal value As DateTime 456 Chapter 9 Querying with LINQ _releasedate value End Set End Property End Class C using System public class Movie public string Title get set public string Director get set public int Genre get set public int RunTime get set public DateTime ReleaseDate get set This is the basic class that is used throughout this section and the following LINQ to Object section. Now that you have a basic class to work with let s look at how you would normally use the class. Listing 9-2 demonstrates how to create a simple generic List of the Movie objects in an page and then binding that list to a GridView control. The GridView displays the values of all public properties exposed by the Movie class. Listing 9-2 Generating a list of Movie objects and binding to a GridView VB @ Page Language VB @ Import Namespace script runat server Protected Sub Page_Load ByVal sender As Object ByVal e As Dim movies GetMovies movies End Sub Public Function GetMovies As List Of Movie Dim movies As Movie _ New Movie With .Title Shrek .Director Andrew Adamson _ .Genre 0 .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.