473,394 Members | 1,748 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,394 software developers and data experts.

Looping through checkboxes

This is my firt .NET project so please bear with me.

I have a form of checkboxes and all I want to do is loop through them
all after the page has been submitted and have their values added to a
string. This was pretty simple using classic ASP but I can't seem to do
it using .NET.

I thought it was as simple as iterating through Page.Controls, but it is
not. Can anyone provide code (VB script) to help
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
2 2064
Are you using a CheckBoxList control or seperate check
boxes in different areas in the form?

If your checkboxes can be grouped together you should use
the CheckBoxList object. It's very easy to loop thru them.

Here's some more details on the control(watch the line
wraps).

http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpref/html/frlrfsystemwebuiwebcontrolscheckboxlistclasst
opic.asp

Suresh.
-----Original Message-----
This is my firt .NET project so please bear with me.

I have a form of checkboxes and all I want to do is loop through themall after the page has been submitted and have their values added to astring. This was pretty simple using classic ASP but I can't seem to doit using .NET.

I thought it was as simple as iterating through Page.Controls, but it isnot. Can anyone provide code (VB script) to help
*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
.

Nov 18 '05 #2

I am not using the List control. Can you provide VB sytnax to walk the
tree to get all the checkboxes?

thank you
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

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

Similar topics

4
by: David | last post by:
Hello. I am looking for advice on what is "best practice" regarding looping through a form to check its checkboxes and associated data fields. Here is what I am trying to do (Here is the page...
2
by: Chris Devol | last post by:
VB.NET 2002. I have a large group of CheckBoxes. I want to check/uncheck all the boxes whenever the "Check All" box is checked/unchecked. I also want to be able to fill an array of flags based on...
7
by: astro | last post by:
I am not farmilar with the object model for webforms. I want to loop through the web form controls - pulling out the checkboxes on the form like the following: For Each ctrl In Me.Controls ...
8
by: Alan Silver | last post by:
Hello, I have a repeater that has code like this... <ItemTemplate> <asp:CheckBox ID="chkDelete" Text="" RunAt="server"/> .... other stuff goes here </ItemTemplate> There is a button below...
2
by: clinttoris | last post by:
Hello, If someone could help me it would be appreciated as I am not having much luck. I'm struggling with my asp code and have some questions relating to asp and oracle database. First...
2
by: Bart Van Hemelen | last post by:
The situation: I have a CheckBoxList cblTest, the items are disabled in cblTest_DataBound in a foreach (ListItem oItem in cblTest.Items) loop. I provide a link that calls a client-side JavaScript...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
1
by: piscarian | last post by:
Hi all, I m doing vb.net window application(Framework 1.1) for second hand book shop with ms access 2003 .It's just school project ,so database is not that big . I have books,customer and...
5
by: Esmeralda | last post by:
My situation: I have a dynamic form with checkboxes. The checkboxes are submitted and added to a database. They are a list. I want to compare the list with what is currently listed in 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.