1

JanusGridExコントロールを使用しています。タイマーを使用して、データベースからのデータでグリッドを毎分更新しています。データベースからデータを更新するときにユーザーが行を選択している場合、更新の完了後に行を再選択するにはどうすればよいですか?

4

1 に答える 1

5

グリッドを更新する前に、選択した行のインデックスを保存してから、選択した行をその値に設定する必要があります。何かのようなもの:

int row = myGrid.Row;

// Perform update

try
{
    vJanusDataGridMeasures.Row = row;
}
// The row index that was selected no longer exists.
// You could avoid this error by checking this first.
catch (IndexOutOfRangeException)
{
    // Check to see if there are any rows and if there are select the first one
    if(vJanusDataGridMeasures.GetRows().Any())
    {
        vJanusDataGridMeasures.Row = 0;
    }
}
于 2012-02-27T18:26:26.937 に答える