Thursday, March 22, 2012

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!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 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!
>.
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!

0 comments:

Post a Comment