I have a WebDataGrid bound to a DataSource. The columns are not being autogenerated. I've made edits to the items in the WebDataGrid. However, I'm not seeing the changes reflected in the GridRecordItem when I loop thru the rows. I was expecting to see the changed values in objGridRecordItem.Text, but I'm still seeing the original values prior to my edits.What am I doing wrong?
Ed T
Private Sub WebDataGridLoop() Dim strColumnName As String Dim objGridRecordItem As GridRecordItem Dim objBoundDataField As BoundDataField Dim i As Integer
For Each row As GridRecord In Me.wdgInvoiceServiceFeeDefault.Rows
Dim objInvoiceServiceFeeDefault As New InvoiceServiceFeeDefault
i = row.Items.Count
For i = 0 To (i - 1)
objGridRecordItem = row.Items(i) objBoundDataField = row.Items(i).Column strColumnName = objBoundDataField.DataFieldName
Select Case strColumnName Case AutoSignupDefaultInvoiceServiceFeeDCSchema.InvoiceServiceTypeID objInvoiceServiceFeeDefault.InvoiceServiceTypeID = objGridRecordItem.Text Case AutoSignupDefaultInvoiceServiceFeeDCSchema.ServiceUnitID objInvoiceServiceFeeDefault.ServiceUnitID = objGridRecordItem.Text Case AutoSignupDefaultInvoiceServiceFeeDCSchema.ServiceFreeQty objInvoiceServiceFeeDefault.ServiceFreeQty = objGridRecordItem.Text Case AutoSignupDefaultInvoiceServiceFeeDCSchema.ServiceFee objInvoiceServiceFeeDefault.ServiceFee = objGridRecordItem.Text End Select
Next
Me.InvoiceServiceFeeDefaultInsert(objInvoiceServiceFeeDefault)
End Sub
Hi,
In that case I would try doing the loop in a late event like PreRender of the grid.
Ed
In the initial Page_Load I'm binding 25 rows from Table1 to a WebDataGrid. The user is allowed to edit, delete, or add new rows. When the user clicks a Save button, I want to write the rows in the grid to Table2. Radoslav's work around for Batch Updating is turning off Activation Behavior and using the server side RowUpdating Event handler. This works fine, just as long as the user makes a change to the row. However, I need to write all rows from the grid to Table2. Isn't there a way to simply loop through the grid and get the new values from the edited rows as well as the unchanged rows?
Thanks,
Then you should look at this post about batch updating with WDG:
http://community.infragistics.com/forums/p/35865/209676.aspx#209676
I don't have any code in either the rowupdating or the rowupdated server side events. I could be wrong, but I assumed these events get triggered when moving from row to row. I'm trying to update the database after the row edits are complete by looping thru the grid rows. The user would click on a Save button and run the procedure. I want to avoid postbacks after every row edit.
I would bet you're running that procedure before the rowupdating event so you'll only see the old values. In the Rowupdating event you can see both. After that (in the rowupdated event) you'll only see the new ones.