"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."
I keep reading how the property builder lets you create simple paging, but I keep getting the above error when I go into property builder and Select Paging, I put a check box in Allow Paging, I set Page Size to 5. Position defaults to Bottom, Mode defaults to NEXT, Previous buttons and Next Page Button Text defaults to > and Previous page button text defaults to < .
If I change any of the values, I still get the error. Here is my code:
<%@ Page Language="
vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.
vb" Inherits="newdatagrid.WebForm1" Debug="False"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 214px; POSITION: absolute; TOP: 67px" autogeneratecolumns="False" runat="server" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" BackColor="White" CellPadding="3" GridLines="None" CellSpacing="1" AllowPaging="True" PageSize="5">
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
<ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="#E7E7FF" BackColor="#4A3C8C"></HeaderStyle>
<FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
<PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
</asp:DataGrid>
</form>
</body>
</HTML>
__________________________________________________ __________
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
OleDbConnection1.Open()
Dim reader As System.Data.OleDb.OleDbDataReader
reader = OleDbCommand1.ExecuteReader
DataGrid1.DataSource = reader
DataGrid1.DataBind()
reader.Close()
OleDbConnection1.Close()
End If
End Sub