Hi - I'm using 2009.1 Netadvantage and I'd like to Ajax enable my grid, but I need to handle the UpdateCell as soon as each cell is changed.
When I set the Browser="XML" then the UpdateCell only fires when you move off the row. Is there a way to make it fire back each time the cell is changed by the user? I need to allow them to enter a value in one cell, have that fire a server side event that then looks ups various things in the data base and fills in a number of other cells on that row in the grid.
Any suggestions much appreciated?
cheers
Jonathan
Jonathan,
Using JavaScript, you can use the client-side AfterCellUpdateHandler, get a reference to the cell that was updated, get a reference to its row, and call processUpdateRow() on that row object. You can then use the UpdateRow event to process that a change was made.
I don't have a sample available to illustrate this, and I don't immediately have a development environment available. Below is some JavaScript code which I believe will achieve the result you're after:
function ultraWebGrid1_AfterCellUpdateHandler(gridName,cellId){ var cell = igtbl_getCellById(cellId); var row = cell.Row; row.processUpdateRow();}
Hi Vince, thanks for the quick reply - it is *almost* exactly what I need....but...
The UpdateCell event is firing after the cell change (due to the processUpdateRow client side call) and I do my logic in that event to go off and update the DataTable that is the DataSource for the UltraWebGrid.
The server side code then jumps into the UpdateRow event and if I break in here I can check the data source is as I expect by doing this:
?directcast(Me.UltraWebGrid1.DataSource,DataTable).Rows(0).ItemArray
In the immediate window. This shows me the items for row 0 with all the fields I have updated....this is taking it directly from the datasource for the grid.
However, the grid itself does not show these changes!
If I add in this line
e.Row.Cells(6).Value = Now.ToString
into the UpdateRow event then I *do* see the current date/time in the 6th column of my row (which is not the field that fired the UpdateCell event - so I know it is able to update fields other than the cell I changed).
I have also tried to call
Me
.UltraWebGrid1.DataBind()
but that doesn't have any effect.
Can you think of anything i'm not doing that I should be?
Thanks again!