selection of all statement using command button

I have a check box and i want to select all checkboxes at a time by clicking command button how can i do that?

I too want to filter by field and select the check box