Question

IN summary . I have an ASPX page. and a button. Clicking the button will load the result based on the parameter the user specified. The problem is if the result is too much, the page is too slow to load.

AS I am writing my question. basically I need suggestion as to which approach is the best practice?

  1. OPTION 1 is it possible for the ASPX page to load in chunks and as the user scroll, more result will be displayed. if so, where do I start reading and how do I do it?

  2. OPTION 2 fix the function behind the button to display 10 records at a time. and add another button such as next page or previous page

  3. OPTION 3 It would be nice , if I know what I am doing, is to show progress to the user, what the code is doing . a nice progress bar.. showing loading .. 10% done, 20% done.. 100% done.. . at least the user is not just watching Internet explorer spinning icon...

ugh, Apologize as this becomes a really long post..





I have a function that loop through a datatable (DT). Lets call this function displayImages.

The DT may have 200 records. what's inside DT, is a list of filenames.

DisplayImages function, determine where the file is located and display the result into the user. The end result is HTML tag like

img src="path/filename.jpg"

I have other routines in displayimages function, but for the sake of simplicity lets just say the displayimages function only loops through DT and spits out the img src="path/filename.jpg"

The problem I am currently having is that displayimages function is too slow to complete all 200 results. And my attempt to give the user some feedback to show where the loop is at has not work very well (I don't know how to make a nice progress bar to show end user what the loop is doing inside displayimages function)

So I have this Idea of displayimages function to show only 10 records at a time. and a user then click a link button or ASPX button. page 1 , page 2 and show on, to display the next result.

I read I can use pagingdatasource. but I am wondering if there is a clever way to just loop the datatable from row 1 to 10
then row 11 to 20 and so on...

I guess my problem is how can I keep that datatable in memory so I can keep referring to it.

I do have an identifier set in the datatable if that can be any help?

Please let me know your suggestion.. Thank you

This is an ASPX website with VB.net code behind

Thanks in advance

Was it helpful?

Solution

In the end I end up with option number 2.

I am not using sql data source in my code. but I only use datatable.

so to achieve option 2 (which is to display 10 records at one time. and the user has the ability to click page 1 page 2 page 3) I use gridview and css.

Gridview is set to display 10 results at one time.

And as the gridview is irrelevant for the user I use CSS to hide all the contents. but only show the pagination row (the last row)

as I am learning to code in asp.net and vb.net I wish to be able to do option 1 or option 3. I am hoping I will be able to learn how to do it in the near future.

Thanks!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top