473,563 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checkbox Value - Please help

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 load I am setting the values of my checkboxes:
chk1.Attributes .Add("checkValu e", "151010")
chk2.Attributes .Add("checkValu e", "151020")
chk3.Attributes .Add("checkValu e", "151030")
chk4.Attributes .Add("checkValu e", "151040")
chk5.Attributes .Add("checkValu e", "151050")
...

When the submit button is clicked, I want to loop through all checkboxes
and retrieve the value of the checkboxes that were selected.
Dim ctrl As New Control
Dim chk As New CheckBox
Dim strIndustry As String

' Loop through all the controls on the panel.
' Create the string for the SQL statement.
For Each ctrl In pnlSearchResult s.Controls
If TypeOf ctrl Is CheckBox Then
' Get value of checkbox
End If
Next

I have tried a few different ways and keep getting errors. Could
someone please provide a solution? Thanks!


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
3 1510
Hi there,
Here is what you need.

' assuming page tracing is enabled...

For Each ctrl In pnlSearchResult s.Controls
If TypeOf ctrl Is CheckBox Then
chk = CType(ctrl, CheckBox)
If chk.Checked Then
Trace.Warn(chk. Attributes("che ckValue"))
End If
End If
Next

Regards
Claudio

"Amy Snyder" <am**@yahoo.com > wrote in message
news:uL******** ******@TK2MSFTN GP10.phx.gbl...
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 load I am setting the values of my checkboxes:
chk1.Attributes .Add("checkValu e", "151010")
chk2.Attributes .Add("checkValu e", "151020")
chk3.Attributes .Add("checkValu e", "151030")
chk4.Attributes .Add("checkValu e", "151040")
chk5.Attributes .Add("checkValu e", "151050")
..

When the submit button is clicked, I want to loop through all checkboxes
and retrieve the value of the checkboxes that were selected.
Dim ctrl As New Control
Dim chk As New CheckBox
Dim strIndustry As String

' Loop through all the controls on the panel.
' Create the string for the SQL statement.
For Each ctrl In pnlSearchResult s.Controls
If TypeOf ctrl Is CheckBox Then
' Get value of checkbox
End If
Next

I have tried a few different ways and keep getting errors. Could
someone please provide a solution? Thanks!


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2
Thank you so much!!!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
I want to get the checkbox status from the datalist web
control when checkbox is placed int the item template of
the datalist.

How can i achieve that?
I have used findcontrol method but it did not help me what
is the other alternate?

Thank you

-----Original Message-----
Hi there,
Here is what you need.

' assuming page tracing is enabled...

For Each ctrl In pnlSearchResult s.Controls
If TypeOf ctrl Is CheckBox Then
chk = CType(ctrl, CheckBox)
If chk.Checked Then
Trace.Warn(chk. Attributes("che ckValue"))
End If
End If
Next

Regards
Claudio

"Amy Snyder" <am**@yahoo.com > wrote in message
news:uL******* *******@TK2MSFT NGP10.phx.gbl.. .
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 load I am setting the values of my checkboxes: chk1.Attributes .Add("checkValu e", "151010")
chk2.Attributes .Add("checkValu e", "151020")
chk3.Attributes .Add("checkValu e", "151030")
chk4.Attributes .Add("checkValu e", "151040")
chk5.Attributes .Add("checkValu e", "151050")
..

When the submit button is clicked, I want to loop through all checkboxes and retrieve the value of the checkboxes that were selected.

Dim ctrl As New Control
Dim chk As New CheckBox
Dim strIndustry As String

' Loop through all the controls on the panel.
' Create the string for the SQL statement.
For Each ctrl In pnlSearchResult s.Controls
If TypeOf ctrl Is CheckBox Then
' Get value of checkbox
End If
Next

I have tried a few different ways and keep getting errors. Could someone please provide a solution? Thanks!


*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!

.

Nov 18 '05 #4

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

Similar topics

4
6147
by: Shufen | last post by:
Hi, I'm a newbie that just started to learn python, html and etc. I have some questions to ask and hope that someone can help me on. I'm trying to code a python script (with HTML) to get values from a html form that consists of about 10 checkbox and a textbox where user have to key in a value to perform a search. From python tutors, I...
4
4617
by: Jack | last post by:
Hi, I have a checkbox the value which goes to a database via a asp page that builds the sql string. In the front end asp page, the checkbox code is written as follows: <i><input type="checkbox" name="chk_Complete" value="<%Response.Write l_IsChecked%>"<%if cbool(l_IsChecked) then Response.Write " checked"%>> The code to captures the...
4
7282
by: Steph | last post by:
Hello, Can someone tell me the script to use for having a change on the same page when using checkbox function ? For example, i would to check one condition and display dynamically a button if the condition is checked on the same page. Thanks in advance for your help
6
1398
by: Rabel | last post by:
I have a shopping cart that I am having a few problems with. I am mostly a flash developer with basic if not little javascript knowledge, I need for my checkout to have a checkbox that if clicked on will populate my shipping addresses with my billing addresses, I have this somewhat working with a code I got off of here thats like this ...
34
3757
by: clinttoris | last post by:
Hello Experts, I have been told to post this in the Javascript forum as I want to do this client side just before my form gets submitted. Once the user clicks the submit button a javascript function needs to run and validate all the checkboxes on my form and make sure none of them are unchecked. I suck at Javascript and my problem is...
0
4085
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me with my problems. Now for my new little problem,I had a problem posting the values from checkbox fields to a database and thats the obstacle I...
0
3096
by: TechnoAtif | last post by:
<?php include "dbconnect.php"; include "commonFunc.php"; ?> <!----------------------------------> <table width="80%" border="1" cellpadding="2" cellspacing="0"> <tr > <td colspan="2"><p>
3
5299
realin
by: realin | last post by:
Hiya all, i am in deep trouble, i thought it was an easy task, but now its getting on my nerves. Well i have a div on a form, which contains a number of checkboxes, as <div class="modalData" id="multipleCommSelect" style="padding: 50px;"> <center>Please select the communities from the list below:<br></center> <label><input...
3
1944
by: chiku1523 | last post by:
Hi, Please find the following code. In function setAnswers, I am looping with each question. I have inner loop, which is looping for each answers of the questions. If any of the answer for question 1 and question2 is selected this code is working fine. But if None of answer of either question selected, it is not iterating through outer loop....
0
7665
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7642
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.