To maintain the state of checkboxes, check out this post: link
The answer provided by bool.dev will keep state during pagination.
The answer titled “Also make this work on normal form submit” will keep state during - uh well - form submit. So maybe you want to create records based on the selected checkboxes. If there are validation errors, you can use this feature to display the gridview again - keeping the checkboxes’ state.