Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1075
Find newly added row
posted

 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

Parents
No Data
Reply
  • 37774
    posted

    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

Children