PageIndexChanged event not firing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have checked that the page_load event doesn't touch the underlying datagrid but I get no PageIndexChange event firing. Any work arounds or any help to get past this problem.
 
Just to understand, the page control shows up fine, but when they click on 1, 2, 3, etc. nothing happens? What does your event handler look like

----- Timothy Elvidge wrote: ----

I have checked that the page_load event doesn't touch the underlying datagrid but I get no PageIndexChange event firing. Any work arounds or any help to get past this problem.
 
Here's the code, GetData is the function that loads the datasource for the ProductsGri

public void OnPageChange (object Sender, DataGridPageChangedEventArgs e

ProductsGrid.CurrentPageIndex = e.NewPageIndex
switch (Filter.SelectedIndex

case 0
GetData("name")
break
case 1
GetData("points")
break
case 2
GetData("now")
break

}
 
I tried a quick example (vb syntax) and didn't have a problem. Here's a snippet of what works

Private dt As DataTabl
Private Sub Page_Load(ByVal sender As Object,
ByVal e As System.EventArgs) Handles MyBase.Loa
If Not Page.IsPostBack The
dt = TSData.GetDataTable("select * from customer"
viewstate("dt") = d
End I
End Su

Private Sub Page_PreRender(ByVal sender As Object,
ByVal e As System.EventArgs) Handles MyBase.PreRende
grdTest.DataSource = CType(viewstate("dt"), DataTable
grdTest.DataBind(
End Su

Private Sub grdTest_PageIndexChanged(ByVal source As Object,
ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs)
Handles grdTest.PageIndexChange
grdTest.CurrentPageIndex = e.NewPageInde
End Su

A few things I can think of to try: 1) Your event handler is not registered, 2) You're not saving viewstate on the grid, or 3) You're loading the grid dynamically and not readding the event handler

I hope this spurs an idea. Good luck

Bil

----- Timothy Elvidge wrote: ----

Here's the code, GetData is the function that loads the datasource for the ProductsGri

public void OnPageChange (object Sender, DataGridPageChangedEventArgs e

ProductsGrid.CurrentPageIndex = e.NewPageIndex
switch (Filter.SelectedIndex

case 0
GetData("name")
break
case 1
GetData("points")
break
case 2
GetData("now")
break



----- Bill Borg wrote: ----

Just to understand, the page control shows up fine, but when they click on 1, 2, 3, etc. nothing happens? What does your event handler look like

----- Timothy Elvidge wrote: ----

I have checked that the page_load event doesn't touch the underlying datagrid but I get no PageIndexChange event firing. Any work arounds or any help to get past this problem
 
Back
Top