is this a immediate line after
dataGridView1.DataSource = ds1.Tables;
if yes, it doest make any difference. you are updating the same data back in the table. rather u should make
and private members of class and in any of the events of your choice on gridview or you can call separate menthod which contains these lines based on some condition.
hope this helps..