I
Imran Aziz
Hello All,
I use the PagedDataSource class to do pagenation, the issue is that my
dataset is a parent, child relation, and there can be updo 30 child item
under each parent item, no since the pagination is based on the no of parent
items, I get huge pages, is there a way to pagenate based on the child
items?
Here is my code
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = ds.Tables["Parent"].DefaultView;
// Indicate that the data should be paged
objPds.AllowPaging = true;
// Set the number of items you wish to display per page
objPds.PageSize = 10;
// Set the PagedDataSource's current page
objPds.CurrentPageIndex = CurrentPage;
lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of "
+ objPds.PageCount.ToString();
lnkPrev.Visible = (!objPds.IsFirstPage);
lnkNext.Visible = (!objPds.IsLastPage);
repKeySources.DataSource = objPds;
repKeySources.DataBind();
Where the parent table is called, Parent, and the child table is called
Child and the have a relationship say of column name ID.
if parent has 10 rows, and child has 10 rows per parent, I end up with 100
rows on the first page.
I need to be able to pagenate based on the no of rows in the child table.
Please help, thanks a lot.
Imran.
I use the PagedDataSource class to do pagenation, the issue is that my
dataset is a parent, child relation, and there can be updo 30 child item
under each parent item, no since the pagination is based on the no of parent
items, I get huge pages, is there a way to pagenate based on the child
items?
Here is my code
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = ds.Tables["Parent"].DefaultView;
// Indicate that the data should be paged
objPds.AllowPaging = true;
// Set the number of items you wish to display per page
objPds.PageSize = 10;
// Set the PagedDataSource's current page
objPds.CurrentPageIndex = CurrentPage;
lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of "
+ objPds.PageCount.ToString();
lnkPrev.Visible = (!objPds.IsFirstPage);
lnkNext.Visible = (!objPds.IsLastPage);
repKeySources.DataSource = objPds;
repKeySources.DataBind();
Where the parent table is called, Parent, and the child table is called
Child and the have a relationship say of column name ID.
if parent has 10 rows, and child has 10 rows per parent, I end up with 100
rows on the first page.
I need to be able to pagenate based on the no of rows in the child table.
Please help, thanks a lot.
Imran.