Download UltraWebGrid 3.1 User`s Manual

Transcript
The following code implements the desired behavior:
In Visual Basic:
' retrieve dataset from server if not already available
LoadUpdatableDataSet()
' create a new blank row and set the GUID
Dim drCustomers As DataRow = DataSet11.Customers.NewRow
drCustomers("GUID") = Guid.NewGuid.ToString("N")
' add new blank row to new rows collection
c_colNewCustomerDataRows.Add(drCustomers _
, drCustomers("GUID").ToString)
' set the GUID in the WebGrid row
e.Row.Cells.FromKey("GUID").Value = drCustomers("GUID")
22. Run the project. Click on one of the cells in the grid to set focus and click the Customers
AddNewButton. Select the CustomerID field and type a unique CustomerID value (remember this is
the unique primary key column) and type something into the company name column. Repeat the add
procedure a couple of times. Click Submit and you should see something like:
Review
This project shows how to use the batch update, delete and add events of the WebGrid. Particular emphasis is
placed on a methodology for adding multiple new rows to a data table where the user can enter the unique
primary key value.