repeating rows in datalist while i click 2nd or 3rd page navigation.
-
Hai all, i have facing a problem while navigating to paging in datalist. i take 10 records for a page.it will display exact 10 records for the first time. if i click second page then it will disply 13 records (3 records from the first page last) and if i click 1 page fgrom 3rd page then also the records in the first page will be 13... pls help me..through any suggestions
Thanks Subbu.
-
Hai all, i have facing a problem while navigating to paging in datalist. i take 10 records for a page.it will display exact 10 records for the first time. if i click second page then it will disply 13 records (3 records from the first page last) and if i click 1 page fgrom 3rd page then also the records in the first page will be 13... pls help me..through any suggestions
Thanks Subbu.
-
Are you using custom paging or your own code for pageing, if its your own code please post
hi.. thanks for ur immediate reply.. pls check this* oncommand=NavigatePage Protected Sub NavigatePage(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Select Case e.CommandName Case "PageNumber" fintCurrentPage = Convert.ToInt32(e.CommandArgument) Dim strselection As String = "" strselection = SearchString If SearchRange.Length > 0 And strselection.Length > 0 Then strselection = strselection & " and " & SearchRange ElseIf SearchRange.Length > 0 Then strselection = SearchRange End If dsPros = getProList(strselection, SortString, fintCurrentPage, PAGE_SIZE) Dim intNoOfRecs As Int32 = 0 Dim intTotPages As Int32 = 0 intNoOfRecs = CType(dsPros.Tables(1).Rows.Count, Int32) intTotPages = CType(dsPros.Tables(0).Rows(0).Item(0), Int32) FormatNavigationMenuBar(fintCurrentPage, intTotPages, PAGE_SIZE, RECS_IN_LIST) dtlstPros.DataSource = dsPros.Tables(1) dtlstPros.DataBind() dtlstPros.UpdateAfterCallBack = True '' lblListStatus.Text = "Displaying " & (((fintCurrentPage - 1) * PAGE_SIZE) + 1).ToString & " to " & ((fintCurrentPage - 1) * PAGE_SIZE) + intNoOfRecs.ToString & " of " & intTotPages.ToString & " matches" lblListStatus.UpdateAfterCallBack = True End Select End Sub Protected Function FormatNavigationMenuBar(ByVal CurrentPageNo As Integer, ByVal TotalNoOfRecords As Integer, _ ByVal MaxNoOfProductsOnAPage As Integer, ByVal ForwardNumber As Integer) As String Dim intStartPageNo As Integer Dim intPageCounter As Integer Dim MaxNoOfBrowseToPageLinksOnAPage As Int32 MaxNoOfBrowseToPageLinksOnAPage = ForwardNumber Dim intTotalPages As Integer Dim objdtPageLink As New DataTable("PageLink ") Dim drPageLink As DataRow With objdtPageLink.Columns .Add("PageNumber", System.Type.GetType("System.String")) .Add("PageID", System.Type.GetType("System.String")) End With 'Compute Total No. of Pages intTotalPages = CInt(Math.Ceiling(TotalNoOfRecords / MaxNoOfProductsOnAPage)) '>> Finding Starting of series If (CurrentPageNo Mod MaxNoOfBrowseToPageLinksOnAPage) = 0 Then intStartPageNo = (CurrentPageNo + 1) - MaxNoOfBrowseToPageLinksOnAPage Else intStartPageNo = (CurrentPageNo - (CurrentPageNo Mod MaxNoOfBrowseToPageLinksOnAPage)) If intStartPageNo = 0 Then intStartPageNo = 1 Else intStartPageNo += 1 End If End