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

Professional in C# and Visual Basic Part 38. 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 7 Data Binding in If newExpression 0 Then If 0 Then newExpression oldExpression Else newExpression End If Else oldExpression End If End Sub script C script runat server protected void GridView1_Sorting object sender GridViewSortEventArgs e string oldExpression string newExpression if newExpression 0 if 0 newExpression oldExpression else newExpression else oldExpression script Notice the listing uses the GridView s Sorting event to manipulate the value of the control s SortExpression property. The events parameters enable you to examine the current sort expression direct the sort or even cancel the sort action altogether. The GridView also offers a Sorted event which is raised after the sort has completed. Enablingthe GridView Pager The GridView also greatly improves upon another common grid navigation feature paging. Although the implementation of paging using a DataGrid greatly simplified paging especially in comparison to paging in ASP the GridView makes it even easier with its AllowPaging property. This property can be set either by adding the attribute to the GridView control in HTML mode or by checking the Enable Paging check box in the GridView s smart tag. Enabling paging in the GridView control defaults to a page size of 10 records and adds the Pager to the bottom of the grid. Listing 7-28 shows an example of modifying your grid to enable sorting and paging. Listing 7-28 Enabling sorting and paging on the GridView control asp GridView ID GridView1 Runat server DataSourceID SqlDataSource1 DataKeyNames CustomerID AutoGenerateColumns False AllowSorting True AllowPaging True 325 Chapter 7 Data Binding in Enabling sorting and paging in your GridView creates a page that looks like Figure 7-17. Figure 7-17

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
389    77    2    21-05-2024
299    2    1    21-05-2024
Đã 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.