There is one check is there which is outside of the gallery Check all

and Inside the gallery one more check box is there

in the gallery collection data is there which is coming from other data source
Condition1: If I will "on Check" the "Select all check box". inside the gallery check box it will select automatically
Condition 2:If I select "on uncheck" it will unselect all the items
Condition 3 :If I select individually then it will select individual data
I want to store the check items into collection