datagrid paging in codebehind vb.net

  • Thread starter Thread starter Alexander Herrmann via .NET 247
  • Start date Start date
A

Alexander Herrmann via .NET 247

Hello,

I declared a Datagrid in my codebehind (in vb.net, the grid is named "CoreDataGrid") and now I want to manage the OnPageIndexChanged-Event in this codebehind and not in the .aspx file.
I already have the associated sub:
Sub CoreDataGrid_Paging(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
CoreDataGrid.CurrentPageIndex = e.NewPageIndex
CoreDataGrid_DataBind()
End Sub

I read some articles about raising events aso but I didn't understood them fully. Maybe someone could explain it to me? thanks a lot
 
Alexander,

Are you using Vistual.StudioNet?

Cor
I declared a Datagrid in my codebehind (in vb.net, the grid is named
"CoreDataGrid") and now I want to manage the OnPageIndexChanged-Event in
this codebehind and not in the .aspx file.
I already have the associated sub:
Sub CoreDataGrid_Paging(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
CoreDataGrid.CurrentPageIndex = e.NewPageIndex
CoreDataGrid_DataBind()
End Sub

I read some articles about raising events aso but I didn't understood them
fully. Maybe someone could explain it to me? thanks a lot
 
Alexander,

In VB.Net, you need to define the method as an event handler. You can
do this by appending the "Handles" keyword at the end of your methods
signature and then type the event you want to handle.

Sub CoreDataGrid_Paging(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs) Handles CoreDataGrid.Paging
 
Back
Top