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
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