Hi
1) ( page 399 )
Post.GetThreadByID method retrieves all posts of a thread via
tbh_Forums_GetThreadByID stored procedure. This procedure doesnât support pagination and in thus it returns all the records from the DB.
Since this procedure doesnât support pagination, I fail to see the point in
objPosts (
objPosts is object data source control defined in page
ShowThread.aspx ) implementing custom pagination?!
Namely, advantage of custom pagination over automatic paging is that custom pagination enables you to minimize the bandwidth usage by retrieving only rows for the currently displayed page, while automatic paging retrieves all the rows from DB.
Since our procedure retrieves all the records, I would think that it would make more sense for
objPosts to implement automatic paging instead of custom pagination and that way save us some coding time?! Or am I missing something?
b) Anyways, I assume the following logic (
GetThreadByID method on page 399 ) is needed to only return as many
Post objects as GridView expects based on
maximumRows parameter value:
Code:
int count = (posts.Count < startRowIndex + maximumRows ? posts.Count - startRowIndex : maximumRows);
Post[] array = new Post[count];
posts.CopyTo(startRowIndex, array, 0, count);
return new List<Post>(array);
To reiterate my previous point, if
objPosts implemented automatic paging instead, then we wouldnât need the above code and thus weâd save us some coding time?!
thanx