W
William Gower
I am getting the following error message when I try to load my page
AllowCustomPaging must be true and VirtualItemCount must be set for a
DataGrid with ID DataGrid1 when AllowPaging is set to true and the selected
datasource does not implement ICollection.
Sub Page_Load()
BindDataGrid()
end Sub
Sub BindDataGrid
Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;"
strConnection += "Data Source=C:\MyBearHug.mdb;"
Dim strSQL As String = "Select firstname,lastname,businessname from
artists order by lastname;"
Dim objConnection As New
System.Data.OleDb.OleDbConnection(strConnection)
objConnection.Open()
Dim objCommand As New System.Data.OleDb.OleDbCommand(strSQL,
objConnection)
DataGrid1.DataSource = objCommand.ExecuteReader()
DataGrid1.DataBind()
end sub sub
PageIndexChanged(sender as Object, e As DataGridPageChangedEventArgs)
DataGrid1.CurrentPageIndex = e.NewPageIndex
BindDataGrid()
end sub
allowpaging is set to true
onpageindexedchange is set to pageindexchanged
pagerstyle is set to nextprev
AllowCustomPaging must be true and VirtualItemCount must be set for a
DataGrid with ID DataGrid1 when AllowPaging is set to true and the selected
datasource does not implement ICollection.
Sub Page_Load()
BindDataGrid()
end Sub
Sub BindDataGrid
Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;"
strConnection += "Data Source=C:\MyBearHug.mdb;"
Dim strSQL As String = "Select firstname,lastname,businessname from
artists order by lastname;"
Dim objConnection As New
System.Data.OleDb.OleDbConnection(strConnection)
objConnection.Open()
Dim objCommand As New System.Data.OleDb.OleDbCommand(strSQL,
objConnection)
DataGrid1.DataSource = objCommand.ExecuteReader()
DataGrid1.DataBind()
end sub sub
PageIndexChanged(sender as Object, e As DataGridPageChangedEventArgs)
DataGrid1.CurrentPageIndex = e.NewPageIndex
BindDataGrid()
end sub
allowpaging is set to true
onpageindexedchange is set to pageindexchanged
pagerstyle is set to nextprev