Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 6th, 2007, 06:09 PM
Friend of Wrox
 
Join Date: Apr 2006
Location: , , .
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with pageddatasource

Hi,

I want to limit the amount of data shown in a page coming from a database.
Everything works except that I get the error on line: PageDataSource.DataSource = SqlDataSource2

"Unable to cast object of type 'System.Web.UI.WebControls.SqlDataSource' to
type 'System.Collections.IEnumerable'"

Thanks for help
H.

code-behind:
-----------
Imports System.Data
Imports System.Data.OleDb

Partial Class Item
  Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
        Dim PageDSource As New PagedDataSource()
        PageDSource.DataSource = SqlDataSource2
        PageDSource.AllowPaging = True
        PageDSource.PageSize = 6
    End Sub
End Class


aspx file:
---------
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ConnectionStrings:prod %>"
SelectCommand="SELECT * FROM [Prod] WHERE ([ItemId] = @ItemId)">
<SelectParameters>
<asp:QueryStringParameter Name="CId" DefaultValue="1"
QueryStringField="ite" />
</SelectParameters>
</asp:SqlDataSource>







Similar Threads
Thread Thread Starter Forum Replies Last Post
PagedDataSource: what's wrong in this code? hertendreef ASP.NET 2.0 Professional 2 February 7th, 2007 02:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.