Select all/deselect all records in gridview

Hi everyone

I am using a gridview in a project and upon selection of records using checkbox column i perform a bulk action

I wants to know that whats is the way to implement select all button for every available data in the gridview

right now i am using checkbox column in gridview and it has select all option but it only selects data on that page

For example if i have set the gridview to display 50 data per page than select option will only select 50 record on click

but i have more than 500 records of data than i will have go though 10 pages and repeat the process

So i want user to be able to select/deselect all 500 records at once

Let me know how can i achieve that

Thank you