I am getting the following error message when I try to load my page
AllowCustomPagi ng must be true and VirtualItemCoun t 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=Micro soft.Jet.OLEDB. 4.0;"
strConnection += "Data Source=C:\MyBea rHug.mdb;"
Dim strSQL As String = "Select firstname,lastn ame,businessnam e from
artists order by lastname;"
Dim objConnection As New
System.Data.Ole Db.OleDbConnect ion(strConnecti on)
objConnection.O pen()
Dim objCommand As New System.Data.Ole Db.OleDbCommand (strSQL,
objConnection)
DataGrid1.DataS ource = objCommand.Exec uteReader()
DataGrid1.DataB ind()
end sub sub
PageIndexChange d(sender as Object, e As DataGridPageCha ngedEventArgs)
DataGrid1.Curre ntPageIndex = e.NewPageIndex
BindDataGrid()
end sub
allowpaging is set to true
onpageindexedch ange is set to pageindexchange d
pagerstyle is set to nextprev
AllowCustomPagi ng must be true and VirtualItemCoun t 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=Micro soft.Jet.OLEDB. 4.0;"
strConnection += "Data Source=C:\MyBea rHug.mdb;"
Dim strSQL As String = "Select firstname,lastn ame,businessnam e from
artists order by lastname;"
Dim objConnection As New
System.Data.Ole Db.OleDbConnect ion(strConnecti on)
objConnection.O pen()
Dim objCommand As New System.Data.Ole Db.OleDbCommand (strSQL,
objConnection)
DataGrid1.DataS ource = objCommand.Exec uteReader()
DataGrid1.DataB ind()
end sub sub
PageIndexChange d(sender as Object, e As DataGridPageCha ngedEventArgs)
DataGrid1.Curre ntPageIndex = e.NewPageIndex
BindDataGrid()
end sub
allowpaging is set to true
onpageindexedch ange is set to pageindexchange d
pagerstyle is set to nextprev
Comment