.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 23rd, 2005, 10:33 AM
megadancer megadancer is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 1 megadancer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 47 sec
Reputation Power: 0
Help with error

I am currently getting this error
AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID shownews when AllowPaging is set to true and the selected datasource does not implement ICollection.
when I am trying to run my page.
Below is the code of the page, if you could please help that would be great. All I want to do is get the paging to work.

<%@ Page Language="VB" Debug="true" %>
<script runat="server">

Sub Page_Load(Sender As Object, E As EventArgs)


Dim sConn as OleDbConnection
Dim sSql as OleDbCommand
sConn = New OleDbConnection("PROVIDER = Microsoft.Jet.OLEDB.4.0;DATA SOURCE = " & Server.MapPath("news.mdb"))
Dim strsql = "Select * from news Order by id desc"
Dim sFilmReader As OleDbDataReader
sConn.Open()
sSql = New OleDbCommand(strsql,sConn)
sFilmReader = sSql.ExecuteReader()
shownews.DataSource = sFilmReader
shownews.DataBind()
sConn.Close()
sFilmReader.Close()




lblMsg.Text = Request.QueryString("Msg")
End Sub

Sub datagrid_pageindex(Sender As Object, E As DataGridPageChangedEventArgs)
shownews.CurrentPageIndex = e.NewPageIndex
shownews.DataBind()
End Sub

</script>
<!--#include file="header.html" -->
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OLEDB" %>
<html>
<head>
<style>A:link {
FONT-WEIGHT: bold; COLOR: #017fd6; TEXT-DECORATION: none
}
A:visited {
TEXT-DECORATION: none
}
A:hover {
COLOR: #b6b6b8; TEXT-DECORATION: underline
}
</style>
</head>
<body>
<table style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; WIDTH: 720px; BORDER-BOTTOM: medium none; HEIGHT: 536px; TEXT-ALIGN: left; border-spacing: 0px" height="536" cellspacing="3" cellpadding="3" width="720" border="0">
<tbody>
<tr>
<td style="border-spacing: 0px" valign="top" width="494" height="399">
<p>
<font face="Verdana, Arial, Helvetica, sans-serif" color="#293d82" size="4">&nbsp;<img height="28" src="news/news.png" width="87" /></font>
</p>

<table height="183" cellspacing="3" cellpadding="3" width="493" border="0">
<tbody>
<tr>
<td width="476" height="177" align="center" valign="top"> <p align="center"><img src="news/dog.png" width="156" height="217">
</p></td>
</tr>
</tbody>
</table>
<table style="WIDTH: 494px; HEIGHT: 256px" height="256" cellspacing="3" cellpadding="3" width="494" border="0">
<tbody>
<tr>
<td valign="top">
<div align="center">
</div>
<asp:datagrid id="shownews" AllowPaging="true" OnPageIndexChanged="datagrid_pageindex" BorderColor="White" BorderWidth="0px" AutoGenerateColumns="False" CellPadding="6" BackColor="#ffffff" Font-Names="Verdana" Font-Size="x-Small" HorizontalAlign="Center" runat="server" Border="none" BorderStyle="None" CellSpacing="6" ShowHeader="False">
<PagerStyle borderwidth="0px"></PagerStyle>
<ItemStyle borderwidth="0px"></ItemStyle>
<Columns>
<asp:BoundColumn DataField="postdate" DataFormatString="{0}"></asp:BoundColumn>
<asp:BoundColumn DataField="title"></asp:BoundColumn>
<asp:BoundColumn DataField="link"></asp:BoundColumn>
</Columns>
</asp:datagrid>
<table style="WIDTH: 67px; HEIGHT: 39px" cellspacing="6">
<tbody>
<tr>
<td>
<p align="left">
<asp:Label id="lblLink" runat="server"></asp:Label>
</p>
<br />
<div><asp:Label id="lblMsg" runat="server" backcolor="White" forecolor="Red"></asp:Label>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>
</p>
</td>
<td valign="top" width="205" rowspan="2">
<!--#include file="righttable2.html" --></td>
</tr>
<tr>
<td valign="top" height="37">&nbsp;

</td>
</tr>
</tbody>
</table>
<!--#include file="footer.html" -->
</body>
</html>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Help with error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT