Summary

In this chapter, we examined how to sort the data in a DataGrid. We started by employing the simplest sorting techniques, which involves setting the AllowSorting and AutoGenerateColumns properties of the DataGrid to True and providing a SortCommand event handler.

Next, we studied how to sort a DataGrid whose AutoGenerateColumns property is set to False. We also looked at adding more advanced features to our sorting, such as allowing users to sort a DataGrid's column's data both in ascending and descending order.

The chapter concluded with a demonstration on how to cache the DataGrid's DataSource at the page level. By caching the DataSource, we can retrieve the DataGrid's data in one trip to the database. When the user opts to sort the DataGrid's data on different criteria, the cached DataSource can be reordered and bound back to the DataGrid, saving a trip to the database. Although this approach saves database accesses, its disadvantages include stale data and increased page size.

In the next chapter, we will examine how to display the data of a DataGrid in multiple pages. This is a very useful technique when you need to display hundreds or thousands of records, because it allows for the vast number of records to be displayed in smaller chunks, making the data easier to read and comprehend.



ASP. NET Data Web Controls Kick Start
ASP.NET Data Web Controls Kick Start
ISBN: 0672325012
EAN: 2147483647
Year: 2002
Pages: 111

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net