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 .
Hello,
We have a link to detailed review on All.Aspx page but on the AllByGenre.aspx we have just bulleted list with its Genre heading.
How we can provide a link to details page on the AllByGenre.aspx page itself.
DataBinding: 'VB$AnonymousType_0`3[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Data.Linq.EntitySet`1[[StarReview, App_Code.epf1pbae, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' does not contain a property with the name 'Id'.
This is the error that I am getting if I try to provide a link for viewdetails.aspx page through the AllByGenre.aspx page which you are providing on the All.aspx page. For this I have pasted the hyperlink code (as mentioned in last post) on the AllByGenre.aspx page, but as this hyperlink needs to get the values for Id and Title hence in the .vb file it should be bound to the Repeater , but I am not getting the reference for the same.
So finally I am asking how we can get reference to Id and Title property.
Now I am trying to provide the link for the ViewDetails Page on the AllByGenre.aspx page itself. but as t requires now the reference for Id & Title so I need to have a reference in the code behind as well, but in the code behind file
Code:
Dim allGenres = From genre In myDataContext.Genres _
Order By genre.Name _
Select New With {genre.Name, genre.Reviews}
I am not able to get reference for the Id, And Title so I get the error
DataBinding: 'VB$AnonymousType_0`3[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Data.Linq.EntitySet`1[[StarReview, App_Code.epf1pbae, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' does not contain a property with the name 'Id'.
So how we can bind Repeater with the Id & Title in code behind file
Thank you
You post a HyperLink and a LINQ query and that's it. No way for us to see how you hook them up, how the Repeater gets its data, how the HyperLink is positioned in the Repeater and so on and so forth.
I said it before and I'll say it again: I can't read your mind and I can't look into your Visual Studio IDE. Just for fun, look over your own posts, try to forget what you already know about this and see if you can understand your own questions....
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Using myDataContext As New DataContext()
Dim allGenres = From genre In myDataContext.Genres _
Order By genre.Name _
Select New With {genre.Name, genre.Reviews}
Repeater1.DataSource = allGenres
Repeater1.DataBind()
End Using
End Sub
Now the hyperlink uses Id and Title to be bound but in code behind file I do not get any reference to those so how we can get reference to those.
Thank you
Your HyperLink is directly in the ItemTemplate which means you're using it to display a genre, not a review. Is that what you're trying to accomplish?
Otherwise, use a nested Repeater, similar to how the BulletedList is now nested in the outer Repeater and use ='<%# Eval("Reviews")%>' as its data source.
Quote:
Just for fun, look over your own posts, try to forget what you already know about this and see if you can understand your own questions....