|
|
|
DataGrid Example: edit, sort, and paging
This example shows how to customize some features of the DataGrid control, to
display data from a table, sort the data, navigate (browse) and edit.
We will use the common example of Customers table from Nortwind database.
-
Fields displayed in the datagrid: CustomerId, CompanyName, ContactName,
ContactTitle.
-
The datagrid can be sorted by any of these fields, in both ascending and
descending order. Initially is displayed sorted by CompanyName field. Clicking
on a column header sorts the data by that column, first click - ascending
order, second click - reverse order (descending).
-
The primary key (CustomerId) is read-only, the others can be edited; click
Edit, modify the value, then click Update or Cancel.
[+] Click here to view the live demo
Note: Don't be surprised if the records get other values between postbacks.
This example is updating the data into the online database, so if you see
values changing, this means other users are making updates right now.
Top
|