Click here to Skip to main content
15,907,906 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi All,

I am making a gridview with paging technique.In my gridview I have 50 rows and have set the AllowPaging to true with PageSize of 10.I have also implemented the PageIndexChanging event.The problem is that my gridview shows 10 records but no page numbers are being seen.So Can you please suggest any thing to view the page numbers ???

This is my code:

VB
dim gvApprovalList as GridView 
gvApprovalList = New GridView With
                                   {
                                       .ID = "gvApprovalList",
                                       .AllowPaging = True,
                                       .AllowSorting = True,
                                       .PageSize = 10,
                                       .AutoGenerateColumns = False,
                                       .Width = Unit.Percentage(100),
                                       .EmptyDataText = ""
                                   }

           gvApprovalList.HeaderStyle.HorizontalAlign = HorizontalAlign.Center
           AddHandler gvApprovalList.PageIndexChanging, AddressOf gvApprovalList_PageIndexChanging


And the Event:

Private Sub gvApprovalList_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
        gvApprovalList.PageIndex = e.NewPageIndex
        gvApprovalList.DataBind()
    End Sub
Posted

1 solution

I searched and found that a line gvApprovalList.PagerTemplate = Nothing
has to be added after adding the control on the page.I tried it and now am able to view the Page numbers properly.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900