Databinding and List<int>

G

Guest

Is it possible to Databind to a strongly-typed list of integers
(List<int>) ? I want to use <%# Databinder.Eval(Container.DataItem,
"XXX") %> inside a Repeater control in my ASPX page, but I don't know
how to get at the List<int> value.


-= Tek Boy =-
 
J

John Timney \(MVP\)

Well I just threw this together and it worked, perhaps it will help you!

List<int> s = new List<int>();
s.Add(1);
s.Add(22);
s.Add(33);
customers.DataSource = s;
customers.DataBind();


<asp:Repeater id="customers" runat="server">
<ItemTemplate>
<tr>
<td><%#Container.DataItem.ToString()%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top