Tải bản đầy đủ (.pdf) (1 trang)

Tài liệu Display, Sort, and Page Data in the DataGrid Control pdf

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (21.76 KB, 1 trang )

5.6 Display, Sort, and Page Data in the DataGrid Control
The Table controls and DataRepeater are fine when I have small sets of data, but the
display just keeps repeating and I have to write a bunch of code to change the sort order
of the data. How do I create a table-like display that will show a set number of rows at a
time and let me sort the data?
Technique
The DataGrid control is by far the most flexible and powerful of the controls used in
ASP.NET for displaying data on your Web page. It gives you the ability not only to list
data, but also to page through it and sort it nicely with headers, and even to edit data. This
last feature will be saved for the next How-To.
To perform the other tasks, you will use a combination of setting properties at design
time and programming some events. In particular for the DataGrid control, you will add
code to events raised by sorting and paging.
This How-To will use the DataGrid bound at design time. You will also see a simple
example of using the DataView object for sorting your data.
Steps
Open and run the Visual Basic .NET -Chapter 5 solution. From the main page, click on
the hyperlink with the caption How-To 5.6: Display, Sort, and Page Data in the DataGrid
Control. You will then see all the territories loaded into a data grid. You can click the
 
 

×