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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping through controls

Status
Not open for further replies.

JGresko

Programmer
Apr 24, 2002
86
US
I have a page that has two groups of 12 identical controls that use the following naming convention
Code:
ctrl1_1, ctrl1_2, ctrl1_3, etc.      and 
ctrl2_1, ctrl2_2, ctrl2_3, etc.

I need to loop through them, inserting their values into a database, when the user presses the submit button.

I'm trying to find a way to do it without hardcoding a reference to each control separately...

Something equivalent to

for i = 0 to 11
get value of ctrl1_i
get value of ctrl2_i
next

OR

for i = 0 to 11
get value of ctrl1(i)
get value of ctrl2(i)
next

Since ASP.Net doesn't have control arrays or dynamic variables, does anyone know a way to do this?

Thanks,
Judy


 


Great!

That gives me some options.

Thanks
 
Kris,

Wrong group or not, they led to a few good tips.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top