paging
אני מנסה לבצע חלוקה לדפים ומקבל את השגיאה 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. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: 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. Source Error: Line 51: objDR = cmd.ExecuteReader Line 52: DataGrid1.DataSource = objDR Line 53: DataGrid1.DataBind() Line 54: End Function הטקסט בתוכנית הוא 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 DataGrid1.VirtualItemCount = 200 get_table() End Sub Private Function get_table() Dim MyConn As New System.Data.OleDb.OleDbConnection(conn.ConnectionString) conn.Open() Dim objDR As System.Data.OleDb.OleDbDataReader objDR = cmd.ExecuteReader DataGrid1.DataSource = objDR DataGrid1.DataBind() End Function Sub DataGrid1_PageIndexChanged(ByVal obj As Object, ByVal e As DataGridPageChangedEventArgs) DataGrid1.CurrentPageIndex = e.NewPageIndex DataGrid1.DataBind() End Sub <asp
ataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server" AllowPaging="True" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" BackColor="White" OnPageIndexChanged="DataGrid1_PageIndexChanged" CellPadding="0" GridLines="Vertical" ForeColor="Black" SelectedIndex="0"> <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#000099"></SelectedItemStyle> <AlternatingItemStyle BackColor="#CCCCCC"></AlternatingItemStyle> <HeaderStyle Font-Bold="True" ForeColor="White" BackColor="Black"></HeaderStyle> <FooterStyle BackColor="#CCCCCC"></FooterStyle> <PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999" Mode="NumericPages"></PagerStyle> </asp
ataGrid></form>
אני מנסה לבצע חלוקה לדפים ומקבל את השגיאה 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. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: 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. Source Error: Line 51: objDR = cmd.ExecuteReader Line 52: DataGrid1.DataSource = objDR Line 53: DataGrid1.DataBind() Line 54: End Function הטקסט בתוכנית הוא 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 DataGrid1.VirtualItemCount = 200 get_table() End Sub Private Function get_table() Dim MyConn As New System.Data.OleDb.OleDbConnection(conn.ConnectionString) conn.Open() Dim objDR As System.Data.OleDb.OleDbDataReader objDR = cmd.ExecuteReader DataGrid1.DataSource = objDR DataGrid1.DataBind() End Function Sub DataGrid1_PageIndexChanged(ByVal obj As Object, ByVal e As DataGridPageChangedEventArgs) DataGrid1.CurrentPageIndex = e.NewPageIndex DataGrid1.DataBind() End Sub <asp