How to Fill GridView Fast
-
I have bulk of data of client information aprox 15000. When I Fill this data to GridView it takes too much time. 1. Fill data with sqldatasource. 2. Fill datatable and bind with GridView. To fill data with datatable to get data I use this code - SqlConnection cnSql = new SqlConnection(strConn); cnSql.Open(); SqlCommand cmd = new SqlCommand(StrSql, cnSql); cmd.CommandTimeout = 50000; cmd.ResetCommandTimeout(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); is there any problem with my code or I have to change some configuration in my web.config ?
-
I have bulk of data of client information aprox 15000. When I Fill this data to GridView it takes too much time. 1. Fill data with sqldatasource. 2. Fill datatable and bind with GridView. To fill data with datatable to get data I use this code - SqlConnection cnSql = new SqlConnection(strConn); cnSql.Open(); SqlCommand cmd = new SqlCommand(StrSql, cnSql); cmd.CommandTimeout = 50000; cmd.ResetCommandTimeout(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); is there any problem with my code or I have to change some configuration in my web.config ?
res.manish wrote:
I have bulk of data of client information aprox 15000.
This is not an good idea to showing this amount of data In gridview at time. What you can do 1. Use Filter Criteria and based on that allow to retrieve Data. Because, there is no sense to load 15,000 at a time, as no one going to check those data at time. So, use filter criteria. 2. Use
Caching
, To Reduce the performance hit. If the data is common for all user, usedataCaching
, use filter from Cached data itself. UseCache Dependency
if you want to update cache if some changes in data. Hope this will help you ! -
I have bulk of data of client information aprox 15000. When I Fill this data to GridView it takes too much time. 1. Fill data with sqldatasource. 2. Fill datatable and bind with GridView. To fill data with datatable to get data I use this code - SqlConnection cnSql = new SqlConnection(strConn); cnSql.Open(); SqlCommand cmd = new SqlCommand(StrSql, cnSql); cmd.CommandTimeout = 50000; cmd.ResetCommandTimeout(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); is there any problem with my code or I have to change some configuration in my web.config ?
Apart from Abhijit's suggestion you may also wish to consider one or more of other methods of displaying data. Some of them are: Paging, Grouping of Records, Pivoting, or using Graphs or charts. The main idea is just don't dump a lot of data to the client browser. Secondly, user can analyse the data if the number of rows are lesser.
Anurag Gandhi.
http://www.gandhisoft.com
Life is a computer program and every one is the programmer of his own life. -
I have bulk of data of client information aprox 15000. When I Fill this data to GridView it takes too much time. 1. Fill data with sqldatasource. 2. Fill datatable and bind with GridView. To fill data with datatable to get data I use this code - SqlConnection cnSql = new SqlConnection(strConn); cnSql.Open(); SqlCommand cmd = new SqlCommand(StrSql, cnSql); cmd.CommandTimeout = 50000; cmd.ResetCommandTimeout(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); is there any problem with my code or I have to change some configuration in my web.config ?
-
I have bulk of data of client information aprox 15000. When I Fill this data to GridView it takes too much time. 1. Fill data with sqldatasource. 2. Fill datatable and bind with GridView. To fill data with datatable to get data I use this code - SqlConnection cnSql = new SqlConnection(strConn); cnSql.Open(); SqlCommand cmd = new SqlCommand(StrSql, cnSql); cmd.CommandTimeout = 50000; cmd.ResetCommandTimeout(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); is there any problem with my code or I have to change some configuration in my web.config ?
You could alos try a third paty control such as the Infragistics UltraWebGrid[^] which has a LoadOnDemand capability and is pretty simple to use. Here: Load On Demand in WebGrid 2[^]. An old article but you get the idea.
Tychotics: take us back to the moon "Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars." H. G. Wells