• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 921
  • Last Modified:

Looping through controls in a FormView

I have a formview control on my page adn I need to loop through all of the label controls on it.  How can I accomplish this?  I keep getting an error stating that the formview has no enumeration type.

Thank you.
  • 2
1 Solution
what happens if you have:

for each c as control in formview.Controls
'do some debug output to verify it is looping


does it output for each control?
stankstankAuthor Commented:
I tried to loop through formview.controls, and for each control make a new label object.  The problem is, not all controls are labels - some are buttons.  It won't let me do foreach label, either.

>> does it output for each control? <<
I am not sure what you mean - can you re-ask the question?

it will loop for every control, so you can put an if statement in there

for each c as control in formview.Controls
   if typeof(c) is checkbox then
      'do something with checkbox c
   end if


my question was just to get you to see if it was finding all the controls ok, say by writing the control name to the debug output - if the control names all appear in the debug output then it is finding the controls ok.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now