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 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
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
----------------------------------------- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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'...
|
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...
|
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...
|
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...
|
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....
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |