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

Binding a Repeater control to an ArrayList of objects

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;
}

I tried this one but it didn't work.

<asp:Repeater Id='rep1' runat='server'>
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "id") %> <br/>
</ItemTemplate>
</asp:Repeater>

Thanks for your help in advance.

regards,
Abhishek.
Nov 18 '05 #1
2 6446
Expose the members you want to Eval as public properties of your
objects, not as fields.

i.e.

public string Name
{
get { ... }
}

HTH,

--
Scott
http://www.OdeToCode.com

On Thu, 05 Feb 2004 13:30:07 +0530, Abhishek Srivastava
<ab*****************@nospam.net> wrote:
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;
}

I tried this one but it didn't work.

<asp:Repeater Id='rep1' runat='server'>
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "id") %> <br/>
</ItemTemplate>
</asp:Repeater>

Thanks for your help in advance.

regards,
Abhishek.


Nov 18 '05 #2
Great Scott!

Thanks for your suggestion. It works!

regards,
Abhishek.

Scott Allen wrote:
Expose the members you want to Eval as public properties of your
objects, not as fields.

i.e.

public string Name
{
get { ... }
}

HTH,

--
Scott
http://www.OdeToCode.com

On Thu, 05 Feb 2004 13:30:07 +0530, Abhishek Srivastava
<ab*****************@nospam.net> wrote:

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;
}

I tried this one but it didn't work.

<asp:Repeater Id='rep1' runat='server'>
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "id") %> <br/>
</ItemTemplate>
</asp:Repeater>

Thanks for your help in advance.

regards,
Abhishek.


Nov 18 '05 #3

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

Similar topics

1
by: Jax | last post by:
I have an arraylist of objects. This arraylist is bound to a repeater. That repeater then creates a set of controls like so <asp:repeater id="garmentRepeater" runat="server"...
1
by: Dot net work | last post by:
Hello. I have an interesting data binding scenario: I have a repeater control. It repeats a typical custom web user control. I also have a collection object, and each collection element...
7
by: charliewest | last post by:
Hello - I'm using a Repeater control to render information in a very customized grid-like table. The Repeater control is binded to a DataSet with several records of information. Within the...
1
by: Alan Silver | last post by:
Hello, I have a page in which I'm trying to give the user the chance to manipulate a list of items. These are the price variations for a product, so each item consists of a name (eg, small,...
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,...
3
by: Andrew | last post by:
Hi, I am working on a questionnaire. I have displayed a questionnaire using a repeater control. The itemtemplate is as below (quite cut down): <ItemTemplate> <tr><td> <%#...
9
by: Jaybuffet | last post by:
my aspx has something like this <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>' showItem="true"/> </ItemTemplate>...
6
by: Milsnips | last post by:
hi there, i have a page with a repeater that is populated with my function called GetList, that returns an arraylist of my custom object, lets say its called Products{ProductID, Description,...
0
by: Eugene Anthony | last post by:
The problem with my coding is that despite removing the records stored in the array list, the rptPages repeater control is still visible. The rptPages repeater control displayes the navigation...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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:
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.