| syukna 2005-05-12, 4:13 pm |
| I'm looking for a way to loop through all of the textboxes on a webform. Basically an easy way to do something like this:
oInsertNVC.Add(Label0.Text, TextBox0.Text);
oInsertNVC.Add(Label1.Text, TextBox1.Text);
oInsertNVC.Add(Label2.Text, TextBox2.Text);
oInsertNVC.Add(Label3.Text, TextBox3.Text);
oInsertNVC.Add(Label4.Text, TextBox4.Text);
oInsertNVC.Add(Label5.Text, TextBox5.Text);
oInsertNVC.Add(Label6.Text, TextBox6.Text);
oInsertNVC.Add(Label7.Text, TextBox7.Text);
oInsertNVC.Add(Label8.Text, TextBox8.Text);
oInsertNVC.Add(Label9.Text, TextBox9.Text);
oInsertNVC.Add(Label10.Text, TextBox10.Text);
oInsertNVC.Add(Label11.Text, TextBox11.Text);
Instead of having to hardcode each label i want to do it dynamically depending on the amount of textboxes in the form.
I tried a for..loop with something similar to Add(Label[i].Text)
It did not work though. Any ideas?
thanks for the help
-seth |