Add a ListBox to your form, name it SelectList and set it to visible=false
place this reference to the function below in your page load event:
PersistState();
//keep checkboxes checked/unchked across paging:
private void PersistState ()
{
for(int i =0;i<DataGrid1.Items.Count;i++)
{
System.Web.UI.WebControls.DataGridItemEventArgs e1 = new DataGridItemEventArgs (DataGrid1.Items[i]);
//if check box is checked add it
if(((CheckBox)e1.Item.FindControl("CheckboxSelect" )).Checked)
{
string sPK = e1.Item.Cells

.Text;//e1.Item.Cells[0].Text + "," + e1.Item.Cells[1].Text + "," + e1.Item.Cells[2].Text ;
ListItem item=new ListItem(sPK);
if(!SelectedList.Items.Contains(item))
{
SelectedList.Items.Add(item );
}
}
//if check box is not checked then
else
{
string sPK =e1.Item.Cells

.Text; //+ "," + e1.Item.Cells[1].Text + "," + e1.Item.Cells[2].Text ;
ListItem item=new ListItem(sPK);
//if un checked item is in the list then remove
if(SelectedList.Items.Contains(item))
{
SelectedList.Items.Remove(item );
}
}
}
}