Click here to Skip to main content
15,746,302 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!
I am using a gridview and I want to use paging. I have already set allow paging to true and page size to 10. I have added the following and it is working but I have to click twice on the index to go to the respective page.
Please help!

Thank You!

VB
Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)Handles GridView1.PageIndexChanging
2
 
3
    GridView1.PageIndex = e.NewPageIndex
4
 
5
End Sub
Posted
Comments
Jignesh Khant 1-Jul-13 5:21am    
You will also have to call the fill grid function.

1 solution

Try this:
C#
GridView1.PageIndex = e.NewPageIndex;
         GridView1.DataSource = //here set the datasource of gridview1
        GridView1.DataBind();
 
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