Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check/Uncheck All Boxes With Different Names

Status
Not open for further replies.

tcannon

Programmer
Jul 24, 2001
4
0
0
US
I have a group of about 60 checkboxes on a form. I have two radio buttons, "Check All" & "Uncheck All" check boxes with a submit button at the bottom of the form.

The names of the checkboxes are dynamically created/generated through ASP and all have a different name (ie: Loc 1, Loc 2, Loc 3, etc...).

How do I "check all" or "uncheck all" boxes for check box type of form elements without knowing the box name?

Thanks!
 
Use a for each loop on the controls collection:

Dim oControl as Control

For Each oControl In Me.Controls
If TypeOf oControl is CheckBox then
oControl.Value = 'true or false here (optCheckAll.Value = 1) maybe??
End If
Next

That should do it... -Chris Didion
Matrix Automation, MCP
 
Shouldn't I do this validation "client-side" with JavaScript?

Please advise, anyone!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top