473,395 Members | 1,386 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,395 software developers and data experts.

Binding Array of DataRows to Repeater

Don't know why I'm having trouble with this:

Dim arNewsletters As DataRow() = dsPubs.Tables(0).Select("CategoryName =
'Newsletters'")
If (arNewsletters.Length > 0) Then
rptNewsletters.DataSource = arNewsletters
rptNewsletters.DataBind()
End If

The code compiles, but if (for the sake of example) my Repeater looks like
this

<asp:Repeater ID="rptNewsletters" Runat="server">
<ItemTemplate>
<%#Container.DataItem%>
</ItemTemplate>
</asp:Repeater>

all I see is:
System.Data.DataRow System.Data.DataRow System.Data.DataRow

(as many times as I have rows)

I usually do all my coding in c#, this is the first vb.net project I've
done. Maybe it's syntax?
Nov 18 '05 #1
1 4996
On 7/29/2004 2:28 PM, George Durzi wrote:
Don't know why I'm having trouble with this:

Dim arNewsletters As DataRow() = dsPubs.Tables(0).Select("CategoryName =
'Newsletters'")
If (arNewsletters.Length > 0) Then
rptNewsletters.DataSource = arNewsletters
rptNewsletters.DataBind()
End If

The code compiles, but if (for the sake of example) my Repeater looks like
this

<asp:Repeater ID="rptNewsletters" Runat="server">
<ItemTemplate>
<%#Container.DataItem%>
</ItemTemplate>
</asp:Repeater>

all I see is:
System.Data.DataRow System.Data.DataRow System.Data.DataRow

(as many times as I have rows)

I usually do all my coding in c#, this is the first vb.net project I've
done. Maybe it's syntax?


No, it's not syntax per se...Container.DataItem is a DataRow at that
point (you bound an array of DataRows, so 1 item is a DataRow), and it's
ToString method (like alot of classes) prints out it's typename. You
have to ask for a column out of that current DataRow, either using a
numerical index or by name.

Note VB.NET uses () for indexes, not [], that syntax might trip you up...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #2

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

Similar topics

0
by: Jim French | last post by:
I have a page that takes a comma delimited string and needs to bind to a Repeater control. The string is split into an Array, and each value is put into a DataBase query via a For Each loop. The...
2
by: Donald Williamson | last post by:
I have a DataReader that I am binding to a Repeater control. In the DataReader, I have two fields: 'Name1' and 'Name2' 'Name1' will always have a person's name. Name2 periodically has a person's...
2
by: Abhishek Srivastava | last post by:
Hello All, What is the syntax to bind a Repeater control to an Array of objects I have an array of objects of type Person Person { public int id; public string name; }
2
by: Marco Ippolito | last post by:
I have an offline DataSet: id (PK, sorted ASC), firstname, enabled 1, Aaron, true 2, Bill, false 3, Charlie, true .... 10001, Mike, false 10002, Nathan, false
2
by: Gastin | last post by:
I am consuming a web serivce from Amazon.Com. I have the following class which was autogenerated by VS.NET when I created a Web Reference to...
4
by: Alan Silver | last post by:
Hello, I'm trying to use an ArrayList to do data binding, but am getting an error I don't understand. I posted this in another thread, but that was all confused with various other problems,...
2
by: ChrisA | last post by:
I have an array of objects I'm binding to a Repeater. Unfortunately, I need to bind to the value returned from a method, while Eval() only seems to work on Properties. Is there a way to do this?...
4
by: Brad Baker | last post by:
I'm going a little crazy :) I'm trying to bind a repeater control to a dataset on page load using the following code: if (Request.QueryString != null) { string customerid = Request.QueryString;...
4
by: De_Kabal | last post by:
I'm trying to bind a 12x16 array to a repeater to display the information in a table to have certain format. Right now all it does is display all the array elements on individual rows. Does anyone...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.