how to show in asp.net grid total rows and actual rows without slowing the performance
we have a asp.net1.1 3开发者_如何学C tiers project in production .
right now for fetching data to asp.net grid, we have a constant call maxRows, and we don't fetch more than that (for performance reason). we have a new request from the customer, "show me the num of total rows in the asp.net grid and the num of actual rows that have been fetch for each grid in the project."
between the presentation layer and the business layer we use .net remoting, and we are passing dataset between the tiers.
the database is ms sql server 2005.
we plan to upgrade this project to .net4.0
what is the solution for this request for .net1.1 and for .net4.0 ?
does asp.net grid have a built in feature to handle paging so we don't get outOfMemory exception for fetching a large amount of records ?
I will suggest you to use CustomPaging.
It will show both the total number of rows in the dataset and you can fetch only the current page of grid and show it to the user:
Refer to the following documentation:
- http://msdn.microsoft.com/en-us/library/aa713421%28v=vs.71%29.aspx
- https://web.archive.org/web/20211020140032/https://www.4guysfromrolla.com/articles/031506-1.aspx
two labels per grid.
num_of_rows_in_grid_label.Text = gridname.Rows.Count.ToString();
actual_num_of_rows_label.Text = datasourcename.Rows.Count.ToString();
(here datasourcename is a name of dataset, datatable or whatever u have there)
this is just a sample code to demonstrate logic, dunno what ur actual code looks like.
精彩评论