|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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"> <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"> </td> </tr> </tbody> </table> <!--#include file="footer.html" --> </body> </html> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > Help with error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|