July 26th, 2013, 05:32 AM
Show More Posts
Hey guys, I'm showing blog posts from a table in sql in a descending order. I want to show a few posts on the page, and then a button at the bottom so that it expands and shows more. I tried a repeat region, showing 5 posts, but cannot figure out how to update the 5 to 10 and so on, incrementing in 5 posts whenever the button at the bottom is pressed. I've also tried removing the repeat region and doing a select top 10 using the id and descending, and trying to update that way but still no luck. Any ideas?
July 26th, 2013, 09:26 AM
that is really depence from how youdesign your page. you can reload all posts with number of posts increased or just add more posts on existing page (preferred).
you need to keep track of number of posts you showing on the page (somewhere in hidden field), when you click button "show more" you need to call another page using ajax or iframe and request from server 5 more posts. after get response from server add to div where you disloying posts your request results.
make sure your query database something like
select top (5) * from postsTable where postId not in (select top (5 * pageNumber) postID from postsTable )
pageNumber is parameter which you will send when reguestion more posts