It seems that the UpdateRowBatch event is called once for each row in a WebGrid that is updated, instead of once for a "batch" of updated rows as its name suggests...
how does this different from the UpdateRow event besides losing cursor focus of an updated row does not trigger a postback?
If I want to handle ALL of the row updates at once, and walk through the grid rows using:
if WedGrid.DataChanged = WebGrid.Modified then
what are my options here?
Should I just handle this in the page_load even and check for Page.IsPostBack?
Thanks,Mike
mccamike said:It seems that the UpdateRowBatch event is called once for each row in a WebGrid that is updated, instead of once for a "batch" of updated rows as its name suggests...
mccamike said:how does this different from the UpdateRow event besides losing cursor focus of an updated row does not trigger a postback?
This means that you don't need to manually "walk" through the grid rows. You'll get one instance of UpdateRowBatch (or UpdateRow) for every row that was updated since the previous postback, and you'll get a reference to that row in the "e.Row" parameter. (This includes rows that were added and modified since the last postback, so checking whether the row is "Added" or "Modified" may still be useful.)
There's one additional event you may want to use when using the grid's batch events: UpdateGrid. This event is raised once after all AddRow, UpdateRow, UpdateCell, and/or DeleteRow events (or their "batch" equivalents) are finished. For instance, if you want to re-bind your grid to be certain that it reflects what's in your data source, you want to do this in UpdateGrid, since doing so in UpdateRowBatch could interfere with the update process.
Ah, very cool... UpdateGrid. Thanks much for the input... we're passing whole DataTables worth of data back to SQL Server here and I need to build a table based on all changed values in the grid, so having UpdateRowBatch called mulitple times is not really what I was looking for... I'll give UpdateGrid a shot.