473,385 Members | 1,606 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,385 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 12623
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:...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.