I am using NetAdvantage 2011.1
I am using the webdatagrid. Instead of using some object data source, I write my own server event handlers. I found that if I edit a cell, it would immediately causes postback and causes persistent change in the database. same with adding a new row deleting a row. i.e., I do not really need a "submit" button to cause a postback. In fact it does everything without a submit button. What I want is the grid to not to postback, until I click the submit button. I want to be able to hit the submit button and cause a batch of changes I make in the grid. I thought that was the default behavior. Apparently I am setting the parameters right. How do I do this?
This is what I do currently:
In the webdatagrid, set AutoCRUD="false", enableajax="False" onRowUpdating="wdg_RowUpdating" EnableDataViewState="True" onrowadding="wdg_RowAdding" onrowsdeleting="wdg_RowsDeleting"
In the <behaviors> section, I set: <ig:EditingCore autocrud="False">
In the code behind, I define these methods to execute some stored procedures to effect persistent changes: wdg_RowUpdating(object sender, RowUpdatingEventArgs e)
wdg_RowUpdating(object sender, RowUpdatingEventArgs e)
wdg_RowAdding(...)
wdg_RowsDeleting(...)
HI erichardson,
Currently, there is no batching behavior or adding. When using those behaviors, they immediately postback. This is to keep sorting, filtering, etc correct. Editing can batch several rows at once. You have to not handle the row updating or row updated server events to get this behavior.
In 11.2, we will actually be adding a batch updating property to the Editing Core. This should solve the problem then.
regards,
David Young
Thank you for your reply.
You wrote, "Editing can batch several rows at once. " but I cannot use the "rowUpdating" or "RowUPdated" methods. How can I handle or persists my editing changes from the grid if I want to use my own data layer code to do it? i.e., I do not want to use a object data source in the aspx page. How can I write code (e.g., to call my stored procedure, etc.) to handle the batch editing changes?
Hi,
Unfortunately that is one of the hitches. If you want to do your own CRUD operations, you need to handle RowUpdating which means that the row update will fire when the active row changes. There's no way around it. This will be different in 11.2.
-Dave
Thanks. Ok, I switched to using asp:SqlDataSource in my aspx page instead of using my own data layer code. In my webdatagrid, I set AutoCRUD="true". I removed the setting EnableAjax="False", onRowUpdating, onRowAdding and onRowDeleting.
I found that the edits are now batched. i.e., no persistent changes to the database until I hit the submit button. However, I found that Delete and Add operations are not batched. To add a record, I enter the data and have to hit return. Just by pressing the Submit button will not actually add the record. To delete, I select the row and press the delete button on my keyboard.
My question is how can I batch the Delete and Add (i.e., defer them until I press the submit button).
As I said in my first post, it is not currently possible to batch adds and deletes. These will commit immediately. If you delete a row in code in the JS, then you can do several at once, but they won't appear any different. As soon as a row is added, it goes back. In 11.2, you will be able to batch these operations more efficiently on the client before commiting them.