You can access the client id of the header checkbox from code behind and store in a HiddenField. Then you can use the following code in the onGridCreated client event of the grid, to check all the row checkboxes and the header checkbox by default:
c#: