CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Looping through Grid checkboxes to see if checked?

Print topic Send  topic

Author Message
drpcken

Posts: 60
Posted: 12/13/2004, 12:28 PM

I need to write a loop that will go through the column of a grid, which contains Checkboxes, and see if they are checked or not.

I can do this easily in codecharge with a ListBox, and loop through to find if the values are selected, but I'm stumped on how to do this with a Grid and checkboxes.

Thanks!
View profile  Send private message
mrachow


Posts: 509
Posted: 12/14/2004, 12:01 AM

Not going into details.

When using an event that fires for every line of the grid you use simply the controls name to access it's properties like value.

There are situations (intended use, bugs whatever) where controls do return a value.
But they should in any case be posted. Here you should know that the name of the controls (like checkboxes) has _1, _2 aso append to their original name.
So having the number of rows in the grid you can walk through your checkboxes by using yourCheckboxName_1 ... in CCGetFromPost().
_________________
Best regards,
Michael
View profile  Send private message
peterr


Posts: 5971
Posted: 12/14/2004, 2:24 AM

drpcken,
I'd recommend that you post the code that you're using with ListBoxes, then someone may get an idea why the same code wouldn't work with checkboxes, or how to modify it.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
drpcken

Posts: 60
Posted: 12/14/2004, 6:37 AM

Here's the code I use for my ListBox Selection loop. It loops through each value in the list box to see if its selected or not.

For i = 0 To ProspectsGroupsGroupId.Items.Count - 1
If ProspectsGroupsGroupId.Items(i).Selected Then
sGroupId = ProspectsGroupsGroupId.Items(i).Value


With sqlSPPGroup
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@Prospect", Convert.ToInt32(sProspectId))
.Parameters.Add("@Group", Convert.ToInt32(sgroupId))
.ExecuteNonQuery()
.Parameters.Clear()

End With

End If
Next i
View profile  Send private message
Stan
Posted: 12/14/2004, 11:55 PM

drpcken

Which CCS control you are use? In case of CheckBoxList control, you can iterate values in the same manner as for ListBox. But if you use several CheckBoxes, you should check each by separate statement, i.e.

If CheckBox1.Checked Then ...
If CheckBox2.Checked Then ...
....

Stan

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.