Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp .net ListView 1

Status
Not open for further replies.

dinger2121

Programmer
Sep 11, 2007
439
US
Hello,
I am trying to populate a listview line by line in a for loop. I do not want to have the listview bound to a datasource. I have to build the list dynamically using 3 string fields that are being changed with each iteration of the for loop.

hope that makes sense.
Thanks for any help.
 
What is a listview? Do you mean listbox? What code have you tried so far?
 
I mean the listview ASP .NET 3.5 control. Every example I've seen is to populate it from a datasource using databinding. I think that a listviewdataitem has to be created and then added, but I don't know how to accomplish it.
 
The ListView is a data control so it needs to be bound to something. The easiest thing to do is just loop through your data and add it to a bindable object (either one your create yourself, or a data object such as a DataTable).

Mark,

[URL unfurl="true"]http://lessthandot.com[/url] - Experts, Information, Ideas & Knowledge
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Website Design
[URL unfurl="true"]http://aspnetlibrary.com[/url] - An online resource for professional ASP.NET developers
 
Thanks ca8msm. I created a datatable that I then populated with my data and bound to the control. worked like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top