views:

367

answers:

2

Hi, it seems common issue so I am surprised I didn't find solution already, maybe someone can help me out. I have a gridview that displays list of users of the app, this list is very big, and takes forever to load the data. Otherwise, data is paged through and once loaded everything goes fine. To help admins, I made search box and that works well. Only issue is initial load of data, it seems that asp.net is retrieving all the records initially.

Is there a way to get only records for current page. Maybe there is a setting for gridview that I am missing or I am doing something else wrong.

Thank you in advance for suggestions.

Zeljko

A: 

Sounds like maybe you're using a Datatable/Dataset when you really want a Datareader. Alternatively, maybe I'm not understanding what you mean by "initial" and what you're experiencing is that you hit the jit compiler every time you do a new deployment.

Joel Coehoorn
+2  A: 

you're going to have to do your own custom paging. Depending on your datasource you have to pass the PageIndex and size, to only get the pages results to be returned.

Ive used this run through before: http://aspnet.4guysfromrolla.com/articles/031506-1.aspx

Glennular
Thanks for the pointer. Yes this seems to be the only way out.
Zeljko Dakic
It is strange that this was not implemented already, this is pretty common pattern of usage. I guess I was hoping that there is a switch that will do this for me, not that creating custom pagging is overly complex (I think).
Zeljko Dakic