Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16550 |

    Hi,
    I have a unbound grid with a insertionRow. I use the insertionrow to add a new row to the grid. My problem is once the new row has been added, how do I track down the the new row, if the grid is sorted it could be placed anywhere in the grid, and there dosn’t seem to be a new-row-added event with the grid?
    Vb.net please
    Thanks in advance.

    Imported from legacy forums. Posted by troy@querytool.com (had 629 views)

    Xceed Support
    Member
    Post count: 5658

    Hi,

    you can keep track of the new row added by subscribing to the AddingDataRowEvent. In its handler you can set the reference of the DataRow added to aglobal variable row.  Furthermore, you can subscribe to the EditEndedevent on the InsertionRow to set the CurrentRow to row and add row to theSelectedRows. 

     

    Forexample: 

    private Xceed.Grid.DataRow row; 

    InsertionRow insertionRow = new InsertionRow();

          insertionRow.EditEnded += new EventHandler( insertionRow_EditEnded );

          gridControl1.AddingDataRow += new AddingDataRowEventHandler( gridControl1_AddingDataRow );

          gridControl1.HeaderRows.Add( insertionRow );

        void insertionRow_EditEnded( object sender, EventArgs e )

        {

          gridControl1.SelectedRows.Add( row );

          gridControl1.CurrentRow = row;

         

        }

        void gridControl1_AddingDataRow( object sender, AddingDataRowEventArgs e )

        {

          row = e.DataRow;

        } 

    Imported from legacy forums. Posted by Mohamed [Xceed] (had 1276 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.