grouping controls together

R

Robert Smith

Hi,
I have several dropdownList controls on my form and I wish to loop
through them all and find the selected value and then concatenate them
together into a string. The problem is I can't find a way to group the
controls together so that I can loop through them, If I put them in a panel I
get a compilation error.

If wish to go
foreach (Control MyControl in ??????)
{
if (typeof(mycontrol) is dropdownlist)
{
mystring = mystring + mycontrol.selectedvalue

}
}

The problem is with the grouping together of the controls not the string
concatenation. How can I group the controls so that I can loop through them?
Thanx in advance

Robert
 
2

2ioconseil - fabrice

You must regroup all the controls in a Panel for example.

And then in tour code-behind:

foreach (Control MyControl in Panel.controls)
 
A

Alex Meleta

Hi Robert,

You can use Table, Placeholder or such containers for this.

Regards,
Alex Meleta
[Tech Blog: http://devkids.blogspot.com]

RS> Hi,
RS> I have several dropdownList controls on my form and I wish to
RS> loop
RS> through them all and find the selected value and then concatenate
RS> them
RS> together into a string. The problem is I can't find a way to group
RS> the controls together so that I can loop through them, If I put them
RS> in a panel I get a compilation error.
RS>
RS> If wish to go
RS> foreach (Control MyControl in ??????)
RS> {
RS> if (typeof(mycontrol) is dropdownlist)
RS> {
RS> mystring = mystring + mycontrol.selectedvalue
RS> }
RS> }
RS> The problem is with the grouping together of the controls not the
RS> string concatenation. How can I group the controls so that I can
RS> loop through them? Thanx in advance
RS>
RS> Robert
RS>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top