datagrid paging in codebehind vb.net

  • Thread starter Alexander Herrmann via .NET 247
  • 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
 
C

Cor Ligthert

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
 
L

Lewis Moten

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top