• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 886
  • 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.
0
stankstank
Asked:
stankstank
  • 2
1 Solution
 
Solar_FlareCommented:
what happens if you have:

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

next

does it output for each control?
0
 
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?

Stank
0
 
Solar_FlareCommented:
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

next



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.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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