468,272 Members | 2,036 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,272 developers. It's quick & easy.

Problem with DataList using Custom Class

I have an ArrayList with NewsItem objects wich have properties 'newsDate'
and 'newsText'

I can off course bind the ArrayList to the Datalist, but how do I procede
from there ?

In the ItemTemplate I've placed two labels wich should show the properties
of each NewsItem.

I'm trying to find out how to databind the properties of the custom NewsItem
class to these labels.

Any help is greatly appreciated.
Jurjen de Groot
G.I.T.S., Netherlands.
Nov 17 '05 #1
1 1338
Hello Jurjen,

Thanks for your post. I'd like to check the following issues:

1. Make sure that the properties newsDate and newsText are exposed with get
and/or set accessor, for example:

class NewsItem{
public string newsDate{
get {
return ...;

public string newsText{
get {
return ...;

2. You can declare the ItemTemplate like the following:
<asp:TextBox id=TextBox1 runat="server" Text='<%#
DataBinder.Eval(ContainerDataItem,"newsDate") %>'>
In the meantime, I believe the following articles/samples are very helpful:

Data Binding Server Controls

INFO: Roadmap for Web Forms Data Binding

DataList vs. DataGrid in ASP.NET

If the problem persists, could you post some code snippet which is able to
demonstrate the problem? I will be glad to check it on my side.

Have a nice day!


Microsoft Online Partner Support

Get Secure! C www.microsoft.com/security
This posting is provided as is with no warranties and confers no rights.
Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Ken R. | last post: by
2 posts views Thread by Gary | last post: by
5 posts views Thread by Martman | last post: by
1 post views Thread by Pavan | last post: by
3 posts views Thread by J'son | last post: by
1 post views Thread by TheHach | last post: by
1 post views Thread by shantanu_kush | last post: by
3 posts views Thread by Crazy Cat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.