infragistics ultrawingrid, adding a prefilled new row.

carmalegno used Ask the Experts™
I'm using infragistics ultrawingrid 2008 v3 .net 2.0

Is there a way to populate a newly added row with a pre-generated data, i need to fill a column unique primary key before the user entered the rest of the column.

(ColumnID) (Data)
col-1            user entered data-1
col-2            user entered data-1
col-3            user entered data-1

The ColumnID must be automatically prefilled after the user clicked the addnewrow button.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Increasing points



it depends on how data is bound to your grid.
if you have bound it to a datasource, you might override the constructor of the class and fill the id-property with your id. That should do.
Otherwise, if you have not bound it, you can override the grid's AfterRowInsert - Event and fill the cell with the value you need.
To do just select the grid, switch to it's event-listing and double-click on "AfterRowInsert".
Visual Studio will generate an empty functon where you can place your code in.
F.e. like in this snipped.

I am using Infragistics 8.2, but it will do in 8.3 as well.

You can have a look in the sample, but almost all code is shown in the snipped-window.
! I left out the infragistics dlls and lic-files - you can't run sample without them !

Private Sub UltraGrid1_AfterRowInsert(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.RowEventArgs) Handles UltraGrid1.AfterRowInsert
        e.Row.Cells(0).Value = "ID" 'f.e. Guid.NewGuid.ToString
    End Sub

Open in new window

ups... there was a crossover doning a poc and you solvin that issue *g*.
Maybe some other user might still need that sample ;-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial