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

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("checkValue", "151010")
chk2.Attributes.Add("checkValue", "151020")
chk3.Attributes.Add("checkValue", "151030")
chk4.Attributes.Add("checkValue", "151040")
chk5.Attributes.Add("checkValue", "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 pnlSearchResults.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 1492
Hi there,
Here is what you need.

' assuming page tracing is enabled...

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

Regards
Claudio

"Amy Snyder" <am**@yahoo.com> wrote in message
news:uL**************@TK2MSFTNGP10.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("checkValue", "151010")
chk2.Attributes.Add("checkValue", "151020")
chk3.Attributes.Add("checkValue", "151030")
chk4.Attributes.Add("checkValue", "151040")
chk5.Attributes.Add("checkValue", "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 pnlSearchResults.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 pnlSearchResults.Controls
If TypeOf ctrl Is CheckBox Then
chk = CType(ctrl, CheckBox)
If chk.Checked Then
Trace.Warn(chk.Attributes("checkValue"))
End If
End If
Next

Regards
Claudio

"Amy Snyder" <am**@yahoo.com> wrote in message
news:uL**************@TK2MSFTNGP10.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("checkValue", "151010")
chk2.Attributes.Add("checkValue", "151020")
chk3.Attributes.Add("checkValue", "151030")
chk4.Attributes.Add("checkValue", "151040")
chk5.Attributes.Add("checkValue", "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 pnlSearchResults.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
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...
4
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...
4
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...
6
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...
34
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...
0
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...
0
by: TechnoAtif | last post by:
<?php include "dbconnect.php"; include "commonFunc.php"; ?> <!----------------------------------> <table width="80%" border="1" cellpadding="2" cellspacing="0"> <tr > <td...
3
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...
3
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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
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...
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.