Ragazzi non riesco a far andare la mia paginazione, vi riporto qui sotto il codice della pagina, questo è l'errore:
"Dettagli eccezione: System.Web.HttpException: AllowCustomPaging deve avere valore true e VirtualItemCount deve essere impostata per un DataGrid con ID gridPrs quando AllowPaging è impostato su true e l'origine dati selezionata non implementa ICollection"
Su uno script d'esempio ho trovato questo:
"Also note that to utilize the default paging with a DataGrid Web control you must use a DataSet. That is, if you set AllowPaging to True but do not employ custom paging, you cannot bind a SqlDataReader or OleDbDataReader to the DataGrid Web control and implement paging. If you attempt to do so you will receive an error along the lines of: "To support paging, you must use an object that supports the ICollection interface." "
Codice PHP:
<%@ Page Language="vb" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Oledb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
If Not Page.IsPostBack then
BindData()
End If
End Sub
Sub BindData()
Dim conClsf As OleDbConnection
Dim cmdMbrs As OleDbCommand
Dim rdrMbrs As OleDbDataReader
conClsf = New OleDbConnection( _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & server.mappath("plan_db.mdb") & _
";")
conClsf.Open
cmdMbrs = New OleDbCommand( _
"select * from Persone order by nome", _
conClsf)
rdrMbrs = cmdMbrs.ExecuteReader
gridPrs.DataSource = rdrMbrs
gridPrs.DataBind
rdrMbrs.Close
cmdMbrs.Dispose
conClsf.Close
End Sub
Sub gridPrs_Paged(sender as Object , e as DataGridPageChangedEventArgs)
gridPrs.CurrentPageIndex = e.NewPageIndex
BindData()
End Sub
</script>
<title>Planimetria</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h2>Elenco Persone <%=now%></h2>
<asp:DataGrid id="gridPrs" runat="server"
Border="0"
Cellpadding="4"
Cellspacing="0"
AlternatingItemStyle-BackColor="#EFEFEF"
ShowHeader="True"
CssClass="DataGrid"
HeaderStyle-BackColor="Black"
HeaderStyle-ForeColor="White"
HeaderStyle-Font-Bold="True"
AllowPaging="True"
PageSize="2"
OnPageIndexChanged="gridPrs_Paged">
</asp:DataGrid>
</body>
</html>