Hi,
I want to use the RadGridView to show data from a DataTable and also allow the user to add new rows. My current version kind of works but there are still some problems:
New rows are not focused
This article says:
If the ItemsSource is a DataTable.DefaultView, you can initialize the newly inserted item as shown in Example 4:
private void radGridView_AddingNewDataItem2(object sender, GridViewAddingNewEventArgs e)
{
e.Cancel = true;
var newRow = this.dataSource.DefaultView.AddNew();
newRow["FirstName"] = "John";
newRow["LastName"] = "Doe";
e.NewObject = newRow;
}
This creates a new row, but it does not set the focus to the new row. I guess this is because the event is actually cancelled and the row is added to the DataTable instead. I tried to manually set the focus afterwards, but so far without success. Is there a recommended solution?
New row is not visible when the grid is already on the last page
I tried combining the RadGridView with a RadDataPager as described here. The paging works, but new rows are always added to the last page. That's okay, and the proposed solution is to move the grid to the last page. This works when the grid is not already on the last page. If it is, however, then the new row is not visible. Only when I navigate to another page and back to the last page, the new row appears. What can I do to show the new row in this case without changing the page?