Nested repeaters Paging problem
-
I have 2 Repeaters with ProductCategory and ProductDetail Architecture.. i.e master detail Wot i want to do is ... enable the paging as a whole rather than ProductCategory or ProductDetail .. Here is sample code for it
strSQL = "SELECT ProductID, ShortDesc, LongDesc, SubCategoryID, PictureUrl, ProductCatID, DataSheetUrl " & _ " FROM dbo.Products ORDER BY ProductID" '& Request.QueryString("subid") strSqlMain = "SELECT ProductCatID, Description, SubCategoryID FROM dbo.ProductCategory Where SubCategoryID=" & Request.QueryString("subid") clsCon.MakeDataSet(strSQL, dsProduct) clsCon.MakeDataSet(strSqlMain, ds) ds.Tables(0).TableName = "Main" ds.Tables.Add(dsProduct.Tables(0).Copy()) ds.Tables(1).TableName = "Products" Dim str1(0) As String Dim str2(0) As String Dim dr As DataRelation = New DataRelation("ProductCat", ds.Tables("Main").Columns("ProductCatID"), ds.Tables("Products").Columns("ProductCatID"), False) ds.Relations.Add(dr) rptCategory.DataSource = ds rptCategory.DataBind() clsCon.sqlConnection.Close()
And the ItemDataBound Event of Master Repeater isProtected Sub BindChild(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then If (CType(e.Item.DataItem, DataRowView).CreateChildView("ProductCat")).Count > 0 Then Dim rpt As Repeater = e.Item.Controls(3) Dim dsPaged As New PagedDataSource dsPaged.DataSource = (CType(e.Item.DataItem, DataRowView).CreateChildView("ProductCat")) dsPaged.AllowPaging = True dsPaged.PageSize = 7 dsPaged.CurrentPageIndex = CurrentPage lblCurrent.Text = "Page: " & (CurrentPage + 1).ToString & " of " & _ dsPaged.PageCount.ToString lblPrevious.Enabled = Not dsPaged.IsFirstPage lblNext.Enabled = Not dsPaged.IsLastPage rpt.DataSource = dsPaged rpt.DataBind() End If End If End Sub
now problem is It makes the Paging enable on Product Repeater meanz .. if i have a Categories like CAT-A CAT-B,CAT-C and all of these categories has 10 items each .. then paging will work as first page will populate with 7 records of A,B,C, e