473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

grouping controls together

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

Mar 31 '08 #1
2 1587
You 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
Mar 31 '08 #2
Hi Robert,

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

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

RSHi,
RSI have several dropdownList controls on my form and I wish to
RSloop
RSthrough them all and find the selected value and then concatenate
RSthem
RStogether into a string. The problem is I can't find a way to group
RSthe controls together so that I can loop through them, If I put them
RSin a panel I get a compilation error.
RS>
RSIf wish to go
RSforeach (Control MyControl in ??????)
RS{
RSif (typeof(mycontrol) is dropdownlist)
RS{
RSmystring = mystring + mycontrol.selectedvalue
RS}
RS}
RSThe problem is with the grouping together of the controls not the
RSstring concatenation. How can I group the controls so that I can
RSloop through them? Thanx in advance
RS>
RSRobert
RS>
Mar 31 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ryan | last post by:
Perhaps someone can settle an arguement for me ? I have a set of data that I need to group together. SQL Script below. CREATE TABLE . ( NOT NULL , NULL , NULL , (10) NULL , NULL ,
2
by: Chris Beach | last post by:
Hi there. I'd like to be able to group together inputs on an HTML form inside, say, a <div> or <fieldset> and then use javascript to iterate through the controls in the group and disable them....
2
by: Andreas Håkansson | last post by:
Seeing how my previous post seem to have fallen between the cracks, I thought I would have a second, more direct, go at it. So my question is "Is it possible to group (Muenchian method) over...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
3
by: _DD | last post by:
I believe Balena's Best Practices book suggests grouping quite a few classes into each namespace. I don't remember a number, but this has me curious about how other programmers handle this. If...
6
by: craig.buchinski | last post by:
Ok, i have a Access Database (which is used with my ESRI Arcmap) and i have written a query for a report to pull out our streetlights and group them by billing wattage. The problem is that it is...
6
by: penjddj1 | last post by:
I have created a report that displays a count for five controls for each month. The controls are yes/no boxes, so each control can have a value of true, false or null. I created two subreports based...
9
by: JakeTheSnake | last post by:
Hello, I'm new here, but am really impressed with the positive attitude! I was wondering if someone could give me some help or point me in the right direction. I have a query that returns the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.