You can avoid executing the code more than once by setting a flag.
private bool inEvent = false;
private void gridDataBoundGrid1_TopRowChanging(object sender, GridRowColIndexChangingEventArgs e)
{
if(!inEvent)
{
inEvent = true;
this.gridDataBoundGrid1.TopRowIndex = ???;
inEvent = false;
}
}