do not receive event in Datagrid

T

ton

Hi,
I'm using a datagrid, which I fill with a subroutine :
When filling the initial 5 rows I want to show the next 5 rows, but the
screen is blank. No control is visible. It looks if the nextprev function is
not executed. What ever code is written there (even when I'm sure it will
result in an error, nothing happened). Why ?
In the beginning of my servercontrol I have:
Public Class dbWebList

Inherits System.Web.UI.WebControls.WebControl

Implements INamingContainer

The function to show the grid:

Public Function ShowGrid(Optional ByVal startpage As Integer = 0) As Boolean

Dim datagrid As DataGrid


Dim SQLdataAdapter As SqlDataAdapter

Dim SQLconnection As SqlConnection

Dim dataset As DataSet

SQLconnection = New SqlConnection("workstation id=VRS7;packet size=4096;user
id=sa;data source=VRS7\VRS7;persist security info=False;initial
catalog=Compass")

SQLdataAdapter = New SqlDataAdapter("select * from tuning",
SQLconnection.ConnectionString)

dataset = New DataSet

SQLdataAdapter.Fill(dataset)

Datagrid = New DataGrid

Datagrid.AllowPaging = True

AddHandler Datagrid.PageIndexChanged, AddressOf Me.nextprev

Datagrid.PageSize = 5

Datagrid.DataSource = dataset

Datagrid.DataBind()

Controls.Add(Datagrid)

end sub

Private Sub nextprev(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)

Dim datagrid1 As DataGrid

'' DataGrid = CType(sender, DataGrid) ''(

_Page = e.NewPageIndex

ShowGrid(e.NewPageIndex)

'' Exit Sub

'' datagrid.CurrentPageIndex = e.NewPageIndex

'' datagrid.DataBind()

''Controls.Add(datagrid)

End Sub
 
T

ton

I allready got the event. The reason was that the createchildrecords was
fired, which did not give the gridcontrol, so the event did not do anything
either.

My next problem is the the NEXT butto (>) workt fine, but the previous can
only be pushed once, but does not generate the previous page.
I expect it has to do with the way these controls are created but do not
have a clue why this is not working.
thanks
ton
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top