RE: grouping controls together
am 31.03.2008 14:37:00 von 2ioconseil - fabriceYou must regroup all the controls in a Panel for example.
And then in tour code-behind:
foreach (Control MyControl in Panel.controls)
> {
> if (typeof(mycontrol) is dropdownlist)
> {
> mystring = mystring + mycontrol.selectedvalue
>
> }
> }
"Robert Smith" wrote:
> 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
>