iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Is this a bug with the Batch Update Process?
I have a page with 4 tabs and 2 WebGrids on each tab. The two WebGrids are contained inside a UserControl, and each tab has an instance of the UserControl that contains the 2 grids. Each grid uses the batch update feature which all works fine.
The user can click "Accept All Changes" on the grid and that grid's data will be sent to the server, updated and the "Pending" changes cleared when batch processing has completed.
However, if the user makes changes to multiple grids on different tabs I also want to be able to Save all changes at once when they click the "Save" button on the WebToolBar.
The Save button invokes a full page postback and all page data is saved. I used the following code to perform a batch update on all grids:
if (grdFactors.GetChanges().Count > 0){ grdFactors.PerformBatchUpdate(true);}
Problem is that when the Full Page PostBack ends and screen refreshes, all the pending changes still appear in the grid.
If I navigate away from the page and back again the changes have been saved.
See my attached sample.
Regards,
Adrian.
Hi Adrian,
I have succeed replicate your issue, and I also encounter a same issue as well. I believe we cannot perform the BatchUpdate on the server side, but we can perform the BatchUpdate from the client side using the AcceptAllChanges() method. That is why, instead of server side button, we need to use a client-side input button and perform a java-script to update the WebGrid.
Here is the sample code that I made on the HTML:
<script language="javascript" type="text/javascript"> // <!CDATA[ function Button1_onclick() { var grid = ISGetObject("grdFactors"); grid.AcceptAllChanges(); } // ]]> </script>
Thank you,
Andi Santoso
Andi,
The reason I don't want to do it on the Client Side is that I have 8 grids to potentially save. That is 8 AJAX postbacks, and the "Save" button on my page must do a full page postback to save other controls also, so the whole process doesn't work so well.
Is there a plan to fix this bug anytime soon as it kinda seems pointless providing a Server Side method to perform the batch update if it isn't going to work.
A bettter workaround in this scenario would be to perform a Response.Redirect back to the same page as the last line of code executed in the postback.
Those are the PerformBatchUpdate’s behavior, as you might notice that, if you try to debug the code, the grdFactors_BatchUpdate is called after grdFactors.PerformBatchUpdate invoked. So, actually the batchupdate is run already and its behavior to leave the highlight on the WebGrid.
But here is the other way to remove the highlight on the WebGrid from the server side. But, no matter how, we still need to use a script to accept all changes in WebGrid and display it, that is why we need to call a java script in the server side.
Here are the sample code that I modify from your sample:
<<HTML>>
<script language="javascript" type="text/javascript"> // <!CDATA[ function update() { var grid = ISGetObject("grdFactors"); window.setTimeout(function() {grid.AcceptAllChanges()},50); return true; } // ]]> </script>
<<C#>>
protected void btnSave_Click(object sender, EventArgs e) { grdFactors.PerformBatchUpdate(true); this.ClientScript.RegisterStartupScript(this.GetType(), "a", "<script language=\"javascript\" type=\"text/javascript\">update();</script>"); }
I am aware that that PerformBatchUpdate method actually calls the grdFactors_BatchUpdate phyiscally saves the data to the database this is desired and documented functionality that I want, what it doesn't do is reflect this in the UI.
The idea (or so I thought) of batch update is to allow me to process multiple changes in one single batch. The documentation states that "In some cases you might prefer to have your own button process the pending changes, in addition to the user the interface provided by the WebGrid".
And this is one of those of those occasions. The PerformBatchUpdate method does physically update my datasource but leaves the datasource and the WebGrid UI in an inconsistent state, and this is a bug in my view.
Your previous post would actually result in processing the pending changes twice:
The WebGrid1_BatchUpdate behavior from server side is to Update the data in server but not for the layout. I am sorry for the inconvenince, but I have sent this issue to the development team and they will enhance this feature in next hotfix.
Thank you,Andi Santoso
I am encountering the same problem. It still does not seem to work correctly. Any idea when this issue will be fixed?
Hi Jocelyn,
The issue is still under investigation. I will inform you as soon as I get news from developer team. Thank you and have a nice day.
Best Regards,
Hey Andi,
Just wondering if this issue has been resolved yet as it is a bit of pain having to a Response.Redirect after every batch update.
Hi Adrian Cunningham,
Yes, deeply apologize for the late respond. Could you kindly get our latest build of WebGrid? In our new hotfix, we introduced PerformBatchUpdate(throwOnError, updateUI).
In your case, you can simply try to use PerformBatchUpdate(true,true)
I hope it can help. Thank you and have a nice day!
Hi Adrian Cunningham,Yes, deeply apologize for the late respond. Could you kindly get our latest build of WebGrid? In our new hotfix, we introduced PerformBatchUpdate(throwOnError, updateUI).In your case, you can simply try to use PerformBatchUpdate(true,true)I hope it can help. Thank you and have a nice day!Best Regards,Andi Santoso
I believe this method already exists in my release. Was it updated to fix this bug?
Dear Shawn,
Yes, I am pretty sure it will, with this PerfomBatchUpdatage(true,true), it will do the batchupdate and update the user interface as well.
I have tried to use this method under your scenario and it works nicely.
I hope it helps. Thank you and have a nice day
Can you tell me the exact version of the WebGrid DLL I need that has this fix, as the version I have contains the method you refer to but I still get errors after doing a batch update via the "PerformBatchUpdate" method.
Dear Adrian,
I have prepared the build of WebGrid for you, please find the attachment of the latest build and the runable sample under your scenario.
Please do not hesitate to let me know if it does not meet your requirements. Thank you and have a nice day.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname