Datagrid and paging

G

Guest

Hello Masters!

Anyone can help me with the datagrid,
well, the app load a lot of data from DB and it show on the datagrid, and
well,
I need to allow paging and.... the issue is with the event PageIndexChanged
of the datagrid 'coz every time when the user change of page the app load
again all data and another processes with the data even though I have load
one dataset with the data for the datagrid..... the question is?
What can I do to link the datagrid with the dataset on the event?

Thanks a lot in advanced.
 
T

TDAVISJR

You probably can cache the Dataset and just work with an in-memory copy.
When you need to use the dataset then cast it back out of the cache object.
I just hope I am understanding your question. Did this give you any help?
 
G

Guest

well, not too much... but anyway thanks...
well, maybe I didn't explain very well.... and well... simplfy my question
would be:

When I change of page, Is first thrown the event PageIndexChanged
or the PageLoad, or just only the PageIndexChanged?

Thanks.
 
T

TDAVISJR

Well it fires both events. So if you put your code to load the dataset into
the Grid in the Page_Load, then yeah, you will be doing it twice. Just make
sure in your page load you load the datagrid once by doing this:

if(!IsPostBack)
{
// do this ONLY the first time the page loads
}
else
{
// do this on all other postback request to this same page
}

Then you are free to load the dataset and bind the datagrid in the
PageIndexChanged. I think this answers your question, but if I didn't a
least I tried! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top