472,958 Members | 1,711 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Databinding and List<int>

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<intvalue.
-= Tek Boy =-

Nov 21 '06 #1
2 12585
Well I just threw this together and it worked, perhaps it will help you!

List<ints = 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
<de*********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
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<intvalue.
-= Tek Boy =-

Nov 21 '06 #2
John --

Awesome -- that's what I needed to know. Thank you!
-= Tek Boy =-

On Nov 21, 2:45 pm, "John Timney \(MVP\)" <x_j...@timney.eclipse.co.uk>
wrote:
Well I just threw this together and it worked, perhaps it will help you!

List<ints = 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.comhttp://www.johntimney.com/blog<deathtos...@gmail.comwrote in messagenews:11**********************@h48g2000cwc.g ooglegroups.com...
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<intvalue.
-= Tek Boy =-
Nov 21 '06 #3

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

Similar topics

2
by: John Dalberg | last post by:
I am adding integer values from a datarow collection to a List<int> using the Add method. The values are read in the correct order from the collection but once the List is populated, the values in...
2
by: per9000 | last post by:
Hi, *background* I want a class containing an int (a list of sets of integer). This should be hidden for the user and he/she should be able to insert his/her favourite data structure so to be a...
8
by: per9000 | last post by:
Hi, I wanted to test to compile an application I build for .NET 2.0 in with the 1.1 C# compiler. I encountered difficulties since I had a List<myClass>. I found a list of what is new in .NET 2.0...
1
by: Monty | last post by:
I have a Usercontrol with a public property List<intLinks List <intLinks= new List<int>(); public List<intLinkLabels { get { return Links; } set { Links = value; } }
10
by: arnuld | last post by:
It is quite an ugly hack but it is all I am able to come up with for now :-( and it does the requires work. I want to improve the program, I know you people have much better ideas ;-) /* C++...
0
by: DR | last post by:
System.Collections.Generic.List<intmyList = new System.Collections.Generic.List<int>(100); Does this preallocate 100 integers? Also, is there any way to preallocate an array of objects all at...
1
by: Danny Ni | last post by:
Hi, I am using a method created by other, the function returns List<int>. If I bind this to a Repeater, what should the data binding expresssion looks like? <%# Eval("I don't know what to put...
6
by: chandramohanp | last post by:
Hi I am trying to modify class instance members using reflection. I am having problem when trying to add/remove/display elements related to List<int> member. Following is the code. class...
15
by: hsachdevah | last post by:
Hello, I am trying to create a dictionary item with its key as list type and value as custom object type. It gives me a error "An item with the same key has already been added." Here is my code:...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.