Posts

Showing posts from September 26, 2010

Optimized Paging and Sorting in ASP.NET GridView

Image
Introduction Paging and sorting are most commonly used features of ASP.NET GridView. And it is very easy to use/implement these features in GridView with small chunk of lines. In this article I am going to demonstrate what are the performance drawbacks of using conventional way to page and sort your GridView and then I will demonstrate 'An Optimized way to implement Paging and Sorting'. What are conventional steps for Paging and Sorting? Usually we perform the following steps to enable paging and sorting in our GridView. 1. Set AllowPaging and AllowSorting Properties of GridView to True to enable paging and sorting respectively e.g view source print ? 1. < asp:GridView ID = "GridView1" runat = "server" AllowPaging = "true" AllowSorting = "true"   > 2.   asp:GridView > 2. Set the PageSize property to mention how many records will be display on each page. 3. Set the SortExpression property of each column. By def

Move Over DataGrid, There's a New Grid in Town!

Image
Move Over DataGrid, There's a New Grid in Town! Dino Esposito This article is based on the May 2004 Technology Preview of ASP.NET 2.0. All information herein is subject to change. This article discusses: The ASP.NET 2.0 GridView, FormView, and DetailsView Differences between the DataGrid and the GridView The programming interfaces of these controls How to achieve master/detail views This article uses the following technologies: ASP.NET, ASP.NET 2.0, C# Code download available at: GridView.exe (124 KB) Browse the Code Online  Contents GridView Versus DataGrid GridView and Data Source Controls The GridView Object Model GridView Events Displaying, Sorting, and Paging Editing Data The DetailsView Control The FormView Control Conclusion Despite the richness and versatility of its programming interface, the ASP.NET 1. x DataGrid control requires you to write a lot of custom code to handle common operations such as paging, sorting, editing, and