Sponsored Ad

Tuesday, February 2, 2010

Improve Data Grid Performance – Use Paging – C#.NET – Reduce DataGrid Binding time

If you data is very huge and you have to display in data grid or infragistics grid. There is one very simple solution to just go for paging.

Data grid provide a simple pager tag to allow paging, Just put inside the

<<DisplayLayout>  tag and have the benefit of paging.

 

There is number of options you can define:

PageSize: Specify the number of results in page

PrevText: Specify Previous text

AllowCustomPaging: Specify the Custom paging – write your paging logic

PrevText: write the previous display test

StyleMode: Paging style mode – numeric , text etc

 

Code Snippet
  1. <Pager StyleMode="PrevNext" AllowPaging="True" PageSize PrevText AllowCustomPaging PrevText StyleMode  >
  2.                            <Style BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray">
  3.                               <BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White">
  4.                               </BorderDetails>
  5.                            </Style>
  6.                       </Pager>

 

This is the simplest solution with large data displaying in one grid. However this method have a drawback, This method will call the database every time you click on the next or previous page. It means it will take same database time every time.

This method only reduces the binding time of grid and that is most important performance factor.

You can opt a Custom paging option to reduce database time.

I will come up with one more post demonstrating the Custom paging.

0 comments:

Post a Comment

Sponsored Ad

More Related Articles

Website Update

Followers