473,499 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Individual CheckBox Web Controls ..HELP

I'm using three checkbox web controls in C# .NET

and one button, and one labe

Is there a way to "group" these individual checkbox web controls

If so, do I use a for loop, hashtable, array, etc

What I'm looking for is how to determine what checkbox was selected from the three checkbox web controls and have the selected checkbox(es) display in a label

I don't want to use the following

if (CheckBox1.Checked == true

//do something

if (CheckBox2.Checked == true

//do somethin

and so fort

What if I had 50 Individual Checkbox web controls I don't want to have the above if statement 50 times in my code behind

I want to have something else-such as a loop that will iterate through the Individual Checkbox controls to check which is selected and print the selected out to the label

Can this be done without using CheckBoxList web control

Any suggestions would be appreciated

Thanks

bebo

code

<asp:CheckBox id="CheckBox1" style="Z-INDEX: 101; LEFT: 40px; POSITION: absolute; TOP: 32px" runat="server
Text="aaa"></asp:CheckBox><asp:CheckBox id="CheckBox2" style="Z-INDEX: 102; LEFT: 40px; POSITION: absolute; TOP: 64px" runat="server
Text="bbb"></asp:CheckBox><asp:CheckBox id="CheckBox3" style="Z-INDEX: 103; LEFT: 40px; POSITION: absolute; TOP: 96px" runat="server
Text="ccc"></asp:CheckBox><asp:Button id="Button1" style="Z-INDEX: 104; LEFT: 40px; POSITION: absolute; TOP: 144px" runat="server
Text="Button"></asp:Button><asp:Label id="Label1" style="Z-INDEX: 105; LEFT: 176px; POSITION: absolute; TOP: 48px" runat="server"></asp:Label

******

Nov 22 '05 #1
0 1256

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

Similar topics

6
3413
by: ML.Steve | last post by:
Hi, There are lots of posts on this subject but after a couple of hours of going though them I still can't get a number of fields to be disabled when a checkbox is ticked. Basically I have a...
3
4844
by: Randy | last post by:
Hello, I'm creating a table on the fly that is used by a datagrid. I'm also creating a tableStyle that is used for the datagrid to make it look like I want. I'm using the DataGridBoolColumn to...
5
3107
by: Greg Hurlman | last post by:
I've got a very simple ASCX page, where once someone finishes a section and clicks the "Next >" button, the section they just finished is disabled, and the next section appears below it, and so on....
0
2386
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
3
1496
by: Amy Snyder | last post by:
For what I thought would be a very simple task is turning out to be very frustrating. I have been trying for a day now to extract checkbox values from my form and nothing is working. On my form...
2
2068
by: bebop | last post by:
I'm using three checkbox web controls in C# .NET and one button, and one labe Is there a way to "group" these individual checkbox web controls If so, do I use a for loop, hashtable, array,...
1
4485
by: dx | last post by:
I'm extremely frustrated with ASP.NET...again! To me this should be as simple as setting oCheckBox.Checked = True.. yet for some reason it isn't. I have a user control (ascx) that that has a...
2
3021
by: Adam Knight | last post by:
Hi all, I have a datagrid with a checkbox in one column. The checkbox is set to autopostback and calls a method named UpdateMailSubscribers. The first click on the checkbox cause the page to...
0
1712
by: creejohn | last post by:
Hi all-- I'm really stumped here. I have a (c# 2.0) calendar control that loads a menu for each day inside the cell corresponding to that day in the dayrender event. That is all working great. I...
1
6000
by: iderocks | last post by:
Hi All, I created a dynamic checkbox in ASP .Net inside a Button1_Click event method (outside the page_load event) and performed the event handling method for the CheckedChanged event and when I...
0
7131
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
7007
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
7174
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
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6894
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
7388
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...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.