473,403 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Bind Repeater. What am I doing wrong?

Hello,

I am binding a Repeater as follows:

Private Sub rFeedback_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles rFeedback.Load

If Not Page.IsPostBack Then
rFeedback.DataSource = "rFeedback_DataSource"
rFeedback.DataBind()
End If

End Sub ' rFeedback_Load

My datasource is as follows:

Private Function rFeedback_DataSource() As DataTable

Dim dtFeedback As New DataTable
dtFeedback.Columns.Add(New DataColumn("Message", GetType(String)))
Dim drFeedback As DataRow
For Each message As String In Me.Messages
drFeedback = dtFeedback.NewRow
drFeedback("Message") = message
dtFeedback.Rows.Add(drFeedback)
Next message
Return dtFeedback

End Function ' rFeedback_DataSource

Note: Me.Messages is a property of type Generic.List(Of String)

Inside my repeater I have a label which I bind, in an ITemplate class,
as follows:

lMessage.Text = DataBinder.Eval(container.DataItem, "Message")

I get the error, on this last code line:

Exception Details: System.Web.HttpException: DataBinding:
'System.Char' does not contain a property with the name 'Message'.

Any idea why?

I have no idea why is this hapenning.

Thanks,

Miguel

Feb 25 '07 #1
2 7061
Umm, you are specifying a string as data source

rFeedback.DataSource = "rFeedback_DataSource"

Remove the double quotes.

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"shapper" <md*****@gmail.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
Hello,

I am binding a Repeater as follows:

Private Sub rFeedback_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles rFeedback.Load

If Not Page.IsPostBack Then
rFeedback.DataSource = "rFeedback_DataSource"
rFeedback.DataBind()
End If

End Sub ' rFeedback_Load

My datasource is as follows:

Private Function rFeedback_DataSource() As DataTable

Dim dtFeedback As New DataTable
dtFeedback.Columns.Add(New DataColumn("Message", GetType(String)))
Dim drFeedback As DataRow
For Each message As String In Me.Messages
drFeedback = dtFeedback.NewRow
drFeedback("Message") = message
dtFeedback.Rows.Add(drFeedback)
Next message
Return dtFeedback

End Function ' rFeedback_DataSource

Note: Me.Messages is a property of type Generic.List(Of String)

Inside my repeater I have a label which I bind, in an ITemplate class,
as follows:

lMessage.Text = DataBinder.Eval(container.DataItem, "Message")

I get the error, on this last code line:

Exception Details: System.Web.HttpException: DataBinding:
'System.Char' does not contain a property with the name 'Message'.

Any idea why?

I have no idea why is this hapenning.

Thanks,

Miguel
Feb 25 '07 #2
Umm, you are specifying a string as data source
>
rFeedback.DataSource = "rFeedback_DataSource"

Remove the double quotes.
Eh! Also put parentheses... calling a method.

rFeedback.DataSource = rFeedback_DataSource()
I'm not a smart guy in VB.Net... but IIRC, parentheses are optional, right?

--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Feb 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: AFN | last post by:
I need to manually create the data to be shown in a datagrid (or some data table object). Should I create an array and bind the array to the datagrid OR should I create a temporary dataset and...
1
by: MattB | last post by:
OK, never mind my last post. It was easy enough to refer to the table the repeater is bound to, but I made a big, incorrect assumption in that post. In my last post I thought I was successfully...
6
by: Zenobia | last post by:
Hello folks, How do I bind an array to a repeater? or bind an array to a hyperlink (which is repeated inside a repeater) ? I get this message: Compiler Error Message: BC30456: 'DataItem'...
2
by: A Traveler | last post by:
Hi, I have a custom collection class i wrote, LineItemsCollection, which is a strongly typed collection of objects of my LineItem class. The LineItem class is a simple class with just a couple...
2
by: Colin Nicholls | last post by:
Platform: ASP.NET 1.1 I have a repeater nested inside another repeater. My outer repeater is looping fine. I am manually binding the inner repeater to a DataReader obtained from another...
2
by: Morten Hauge | last post by:
Hi! I have a problem, I'm not sure if this is the proper way to do it, but I have the following scenario: I want to list all categories, and all products in that category whenever I select a...
5
by: Jaybuffet | last post by:
a custom object. Similar to how I bind a collection of objects to a repeater. Is there a way to bind a single object to a Table? I could use a repeater, but seems over kill for a single object....
0
by: Will Chamberlain | last post by:
Before I start let me clarify that an XmlDataSource will not work for what I am doing. I am attempting to recreate a .NET version of binding Xml Data Islands to HTML Tables in IE 5.x+. You could...
4
by: Pieter | last post by:
Hi, I want to bind a proeprty of a child object to a DataGridView, but it doesn't work. For instance: Imagen that I have an object Company, and this object company has a child object...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.