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!

Loop through FormView records

Status
Not open for further replies.

crabgrass

Technical User
Aug 29, 2007
111
US
Could someone help me with the proper syntax to loop through the records in a Formview? Something like

Code:
For i = 0 To FormView1.DataItemCount - 1
   Response.Write(FormView1.DataKey(i).Value.ToString())   
Next

I keep getting an 'index out of range' error or a 'Value not found ...' no matter how I structure it.

DataItemCount shows a positive integer in this example.

Thanks
 
Why don't you just loop through the data source that you used to bind the formview? And why are there multiple records in a data source that is being bound to a formview?


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top