Hello,
I have an UltraWebGrid inside an AJAX 2 Web application, with many checkboxes for a time control application.
My problem is that when the users click on those checkboxes , they do not wait for the async postback to terminate, even with an "updating - please wait" warning message I'm showing them.
When that happens, the clicking becomes erratic because some of the checkboxes clicked when the postback was still running are not valid and they dissapear, showing a buggy behaviour.
I was thinking that the way to prevent this is by blocking the UltraWebGrid while the async postback is still running.
Am I right that the only way to do this is by using Client Side Object Model (JavaScript)+existing code behind ?
My idea is that the first thing to do, on the client side is disable the grid, then call the already existing function at the code behind for the "click event" , because all the logic is still in code behind (too complex to change it, better leave it as it is). And when this finishes, enable the grid again.
But, I don't know how to call the already existing code behind function from the client side and where to find a reference for the methods to enable and disable editing the whole grid from the client side.
Any help will be tremendously appreciated 8-D
Thanks in advance,
John
I think I've found a workaround: Basically I inject a function in case of a post back that sets a timer in 1 ms (so it executes immediately) to enable the grid:
protected void Page_Load(..){...if (IsPostBack){ string str_Script = "setTimeout(function(){var myGrid = igtbl_getGridById(\"UltraWebGrid1\"); myGrid.Element.disabled=false;},1);"; System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "EnableTheGrid", str_Script, true);}...}
I'm sorry... Instead of
this.UltraWebGrid1.DisplayLayout.ReadOnly = Infragistics.WebUI.UltraWebGrid.ReadOnly.NotSet;
I'm using
UltraWebGrid1.DisplayLayout.AllowUpdateDefault = Infragistics.WebUI.UltraWebGrid.AllowUpdate.NotSet;
... but I'm have no hope about it too...
It ain't over til it's over. I was too confident with my code, but the chaos strikes again:
Sometimes, the grid remains disabled forever when the UltraWebGrid1_ActiveCellChange() code behind function ends. I don't know what causes this because no error is thrown on the output window, and the debugger does not stop.
It is not related to the data it works on, is something that makes the grid not to refresh itself...
For the time being I added this line to the end of page_load() with the naive intention of provoking a refresh:
...but I think that will NOT be useful, because when this method starts, the value is already "NotSet"...
Do you know what can be the cause for the problem and other alternatives to proceed ?
Thanks in advance !
Hi John,
This is the default behavior of the grid.
Let me know if you have any other questions.
I did it in a similar way, thanks:
function UltraWebGrid1_AfterCellUpdateHandler(gridName, cellId){ var myGrid = igtbl_getGridById("UltraWebGrid1"); myGrid.Element.disabled=true;}
It works flawlessly ! But there is one thing that I don't understand (even if it is fantastic for me to do it automatically): After the postback event ("UltraWebGrid1_ActiveCellChange", server side), the grid reenables itself.
It is ok for me, because that's what I want the application to do, but I don't understand why. Do you know if this is a behaviour by default, or is it because my application could have an instruction somewhere doing it ?
Best regards,
John.