Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 August 20th, 2009, 07:37 PM
Authorized User
 
Join Date: Jul 2009
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Linq: DataBinding: 'System.Char' does not contain a property with the name 'X'.

I'm getting this error: DataBinding: 'System.Char' does not contain a property with the name 'Title'.
Code:
It occurs when the Repeater try's to databind.  I have a property (column) named title in the Review table (???)


Code:
   Using myDataContext As New TreatReviewDataContext()

           
            Dim allReviews = From review In myDataContext.Reviews _
            Order By review.Title _
                       Select New With {review.Title}

            Repeater1.DataSource = allReviews
            Repeater1.DataBind()


        End Using
    End Sub
</asp:GridView> <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate><h3> <asp:Literal ID="Literal1" runat="server" Text='<%#Eval("Title")%>'></asp:Literal> </h3> <asp:BulletedList ID="lstReviews" runat="server" DataSource='<%#("Reviews")%>' DataTextField="Title"> </asp:BulletedList> </ItemTemplate> </asp:Repeater>
 
Old August 20th, 2009, 11:21 PM
Authorized User
 
Join Date: Jul 2009
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem is in the DataTextField; if I remove it - no errors. My understanding is that the data text field refers to the column I want shown? That was a valid column name.
 
Old August 21st, 2009, 03:42 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Take a look at the LINQ query:

Select New With {review.Title}

You're only selecting the Title, not the Reviews collection used for BulletedList control.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Linq and namespaces System and System.Xml roman BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 July 4th, 2008 01:15 PM
Big challenge here! How to convert char* to char^? samiswt Visual C++ 2005 1 November 30th, 2007 09:09 PM
ERROR: Procedure or Function 'x' expects paramater rsearing ASP.NET 2.0 Basics 7 March 3rd, 2007 07:02 AM
Invalid conversion from 'char*' to 'char' deuxmio C++ Programming 3 December 8th, 2006 07:56 AM
Webform listbox databinding to any property Rachel P VS.NET 2002/2003 0 October 1st, 2005 10:11 PM





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