Wrox Programmer Forums

Need to download code?

View our list of code downloads.

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
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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>
Reply With Quote
  #2 (permalink)  
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.
Reply With Quote
  #3 (permalink)  
Old August 21st, 2009, 03:42 AM
Imar's Avatar
Wrox Author
Points: 71,692, Level: 100
Points: 71,692, Level: 100 Points: 71,692, Level: 100 Points: 71,692, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,019
Thanks: 79
Thanked 1,580 Times in 1,557 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!
Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 08:09 PM
ERROR: Procedure or Function 'x' expects paramater rsearing ASP.NET 2.0 Basics 7 March 3rd, 2007 06:02 AM
Invalid conversion from 'char*' to 'char' deuxmio C++ Programming 3 December 8th, 2006 06:56 AM
Webform listbox databinding to any property Rachel P VS.NET 2002/2003 0 October 1st, 2005 10:11 PM



All times are GMT -4. The time now is 09:31 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.