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
ataList ID="DataList1" runat="server">
<ItemTemplate>
.....
</ItemTemplate>
</asp
ataList>
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
<ItemTemplate>
.....
</ItemTemplate>
</asp