problem with PagdDataSource (new vesrion)

C

Chris

Hi,

I try to implement paging with PagedDataSource but i get two different
errors:

with the line: "PageDataSource.DataSource = ds" i get the error:
"Unable to cast object of type 'System.Data.DataSet' to type
'System.Collections.IEnumerable"

with the line: "PageDataSource.DataSource = p" i get the error:
"Cannot compute Count for a data source that does not implement ICollection"

I thougt Dataset implements class IEnumerable ...

Can anybody tell me what to change in this code?
Thanks
Chris

code-behind:
-----------
Dim PageDataSource As New PagedDataSource()
Dim ds As DataSet
Dim d As SqlDataAdapter
Dim sql As String
Dim sConnectionString As String
Dim x As Integer
Dim p As String

sConnectionString =
System.Configuration.ConfigurationManager.ConnectionStrings("prod").ToString()
sql = "SELECT * FROM [Product]"
d = New SqlDataAdapter(sql, sConnectionString)
ds = New DataSet()
x = d.Fill(ds)

p = ds.Tables(0).ToString
PageDataSource.DataSource = ds
'PageDataSource.DataSource = p
PageDataSource.AllowPaging = True
PageDataSource.PageSize = 4

DataList1.DataSource = PageDataSource
DataList1.DataBind()

aspx file:
---------
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
.....
</ItemTemplate>
</asp:DataList>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top