sj1187534
Centurion
Hi...I am having a problem with datafrid paging...Here's the code that i am using :
Private Sub dgrFree_PageIndexChanged(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dgrFree.PageIndexChanged
Me.dgrFree.CurrentPageIndex = e.NewPageIndex
BindData(GetDataByCategory("free"))
End Sub
Private Function GetDataByCategory(ByVal cat As String) As DataSet
Dim ds As DataSet
Dim catb As New B
ds = catb.SearchByCategory(cat)
Return ds
End Function
Private Function BindData(ByVal ds As DataSet)
If Not ds Is Nothing Then
Me.dgrFree.DataSource = ds.Tables(2).DefaultView
Me.dgrFree.DataBind()
Else
Me.dgrFree.DataSource = Nothing
Me.dgrFree.DataBind()
End If
End Function
The index of the page is changing but it shows the first page all the time. I think there is some problem in re-loading the datagrid.
Thanks
SJ
Private Sub dgrFree_PageIndexChanged(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dgrFree.PageIndexChanged
Me.dgrFree.CurrentPageIndex = e.NewPageIndex
BindData(GetDataByCategory("free"))
End Sub
Private Function GetDataByCategory(ByVal cat As String) As DataSet
Dim ds As DataSet
Dim catb As New B
ds = catb.SearchByCategory(cat)
Return ds
End Function
Private Function BindData(ByVal ds As DataSet)
If Not ds Is Nothing Then
Me.dgrFree.DataSource = ds.Tables(2).DefaultView
Me.dgrFree.DataBind()
Else
Me.dgrFree.DataSource = Nothing
Me.dgrFree.DataBind()
End If
End Function
The index of the page is changing but it shows the first page all the time. I think there is some problem in re-loading the datagrid.
Thanks
SJ