Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > problem with PagdDataSource (new vesrion)

Reply
Thread Tools

problem with PagdDataSource (new vesrion)

 
 
Chris
Guest
Posts: n/a
 
      02-07-2007
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.Connecti onStrings("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:
---------
<aspataList ID="DataList1" runat="server">
<ItemTemplate>
.....
</ItemTemplate>
</aspataList>


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57