Hi!
I am adding rows to datasourse of the grid and want to get newly added rows (to select or mark them). How to do this?
I am adding rows like this:
//copy old row to new row with a different name
DataRow newDataRow = newDataTable.NewRow(); foreach (DataColumn dataColumn in newDataTable.Columns) //init from input { newDataRow[dataColumn.ColumnName] = oldRow[dataColumn.ColumnName]; } newDataRow["Name"] = newName; newDataTable.Rows.Add(newDataRow);
ultraGrid1.Rows[newDataRow].Selected = true; //this is not compiling
I have no this.lastDataRow and I don't need to go to InitializeRow. All I want to do - insert row in the grid and select it. If it isnot possible to receive inserted row from dataSource tell if it is possible to insert row directly into the grid or find row in ultragrid by key or something
I'm not sure if any notification will be given by the grid to tell you that a row has been picked up from the DataSource (aside from InitializeRow). You could probably check the InitializeRow event's e.Row property to see if it's the same row:
if(e.Row.ListObject == this.lastDataRow)
// Do stuff
Another option is to call this.ultraGrid1.Rows.GetRowWithListIndex(indexOfDataRow);
-Matt