0

I have a list on the left side:

computers
mouses
keyboards
etc

I also have a gridview which appears when I press on one of them.

The problem is in paging: it doesn't appear

If I press on computers, it load a list on gridview and when i press on pag number two in gridview, gridview dissapears, and if i press on computers again i can see the list on page number two...

i want when i press on page 2, it load, i dont want my gridview dissapears...

properties..

AllowPaging=true
EnableSortingAndPaddingCallbacks=true
Sorting=true

do i forgeting something?

Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging

        GridView1.PageIndex = e.NewPageIndex

        Dim tabla As New DataTable()
        tabla = daoprod1.busquedaxCategorias(Session("micategoria"))
        GridView1.DataSource = tabla
        GridView1.DataBind()

    End Sub

i had tried of many forms and it continue dissapearing

Brian Webster
  • 30,033
  • 48
  • 152
  • 225
angel
  • 4,474
  • 12
  • 57
  • 89
  • You should show us the way you control the visibility of GridView2. It's also impottant not to `DataBind` the first GridView on Postbacks, hence check for `not Page.IsPostBack`. – Tim Schmelter Jul 03 '11 at 16:32

2 Answers2

1

Do you have a PageIndex changed event? If yes What is your code in PageIndex changed event?

Here is the MSDN link try the sample code provided.

Anuraj
  • 18,859
  • 7
  • 53
  • 79
0

You don't need to create new datatable just add GridView1.PageIndex = e.NewPageIndex and your grid like this

Protected Sub GridView1_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles GridView1.PageIndexChanging

        GridView1.PageIndex = e.NewPageIndex
        Me.bindgrid()
    End Sub
Bipul Roy
  • 163
  • 1
  • 14