Đ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 38

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Professional ASP.NET 3.5 in C# and Visual Basic Part 38. 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 7 Data Binding in ASP.NET 3.5 If oldExpression.IndexOf newExpression 0 Then If oldExpression.Length 0 Then e.SortExpression newExpression oldExpression Else e.SortExpression newExpression End If Else e.SortExpression oldExpression End If End Sub script C script runat server protected void GridView1_Sorting object sender GridViewSortEventArgs e string oldExpression GridViewl.SortExpression string newExpression e.SortExpression if oldExpression.IndexOf newExpression 0 if oldExpression.Length 0 e.SortExpression newExpression oldExpression else e.SortExpression newExpression else e.SortExpression 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 ASP.NET 3.5 Enabling sorting and paging in your GridView creates a page that looks like Figure 7-17. Figure 7-17

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