For the older UltraWebGrid, we were able to use grid.IsXmlHttpRequest to differentiate between the grid's AJAX postback vs a full page postback, where the AJAX postback was initiated by grid.invokeXmlHttpRequest(...).
In the new WebDataGrid, is there a way to differentiate between a full page postback vs the AJAX postback of the grid, say in the grid Load event handler? I want to perform different actions depending upon how the grid is posted back.
var grid = $find("WebDataGrid1"); var callbackObject = grid._callbackManager.createCallbackObject(); grid._callbackManager.execute(callbackObject);
You can check if a post back is asynchronous through the page’s ScriptManager. The ScriptManager has a property called IsInSyncPostBack that indicates whether the current postback is async. If the postback is being done asynchronously IsInAsyncPostBack would be set to true. You can find further information about this property in the following link:
Please let me know if you have any questions concerning this matter.
Thanks for the quick response.
IsInAsyncPostBack is FALSE for both the Call Back Manager AJAX postback (above) and grid paging AJAX postback.
The only instance where I can get the IsInAsyncPostBack to be true is if I enclose the grid in an Update Panel and post it back (partial postback).
Is there anything else that I can use?
Thank you for your patience. I have done some further research into this matter and have been unable to find a method to check for an async postback. I have contacted our development team and will update you with the information they provide. I will give you a progress update by Monday.
I have heard back from development concerning this matter. You can use the following code to determine if a postback was async for the WebDataGrid:
I have attached a sample to demonstrate this behavior. The sample has selection enabled to cause a postback when the selection changes and there is an Html Input button to cause a postback.
Doesn't work for WHDG. When I click [+] to expand Children and Ajax method is called WHDG's RunBot.IsCallback is False. Any way to detect this call?
Got it: http://codecorner.galanter.net/2012/04/13/whdg-correctly-detect-async-callback/
Hi, I'm having the same issue with the WebTab control, but this one does not have a RunBot instance.
Thanks in advance,