views:

1707

answers:

2

I'd like to add rows to an UltraWebGrid directly on the grid, which is connected to an ObjectDataSource. According to the documentation, I'm supposed to use the InsertDBRow method (there are also UpdateDBRow and DeleteDBRow) to handle database persistence.
Does anyone has any example on what's the supposed usage of these methods? (I already tried the help and Infragistics forums, with no success)

I'm planning on using this grid on a web page for fast data entry. If anyone has any tips toward this end, I'd most appreciate it.

I'm using Infragistics 2008 v1, ASP.Net.

+1  A: 

You should be able to create a new instance of the UltraGridRow class and pass it to the UltraWebGrid's InsertDBRow method.

Here's an example of inserting a row using InsertDBRow.

// Create new UltraGridRow (using the object[] constructor)
var newRow = new UltraGridRow( new[] { "My First Value" , "My Second Value" } );
UltraWebGrid1.InsertDBRow( newRow );
Steve Dignan
+1  A: 

You can use a generic function to handle the CRUD of the grid or call one of the DBRow(InsertDBRow, UpdateDBRow & DeleteDBRow) function directly each time. Example you can find below:

protected void UltraWebGrid_UpdateRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e)
        {
           CRUDHelper(e, UltraWebGrid);
        }


private void CRUDHelper(Infragistics.WebUI.UltraWebGrid.RowEventArgs e, UltraWebGrid pUltraWebGrid)
        {
            switch (e.Row.DataChanged)
            {
                case Infragistics.WebUI.UltraWebGrid.DataChanged.Added:
                   pUltraWebGrid.InsertDBRow(e.Row);
                    break;

                case Infragistics.WebUI.UltraWebGrid.DataChanged.Modified:
                    pUltraWebGrid.UpdateDBRow(e.Row);
                    break;

                case Infragistics.WebUI.UltraWebGrid.DataChanged.Deleted:
                    pUltraWebGrid.DeleteDBRow(e.Row);
                    break;
            }
        }
Alexei