Hi.
The Ajax LoadOnDemand is not working, except for tab content that has a URL for its content (a value for ContentUrl). If I change the content to a template or UserControlUrl the Ajax does not work (the whole page reloads).
You can even see this happening on the Samples Browser
http://samples.infragistics.com/2010.1/WebFeatureBrowser/Default.aspx
WebTab -> Load On Demand -> Web Data Grid tab
The Ajax on that page may or may not be working, its hard to tell, but at least it is not showing the loading icon like the other tabs.
I used the exact code from that page to test, am I doing something wrong?
-dave
Hi Dave,
The EnableLoadOnDemand alone does not mean async postback. It means that only content of selected tab is created on server and passed to client. Of course postback is full. If you need async postback, then you also should use EnableAjax. If both those properties are enabled, then on initial load only selected tab is loaded, but on all other postbacks (changes of selected tabs) all previously selected tabs are loaded as well. So strictly speaking that in not 100% LoadOnDemand. That limitation comes from framework of AJAX and event validation. The dot net does not support changes of once asynchronously loaded UpdatePanels: content all loaded UpdatePanels must be reloaded on all following async postbacks. Therefore WebTab has quite a logic related to get around that "feature" of AJAX.
WebTab also has extra property EnableLoadOnDemandViewState which is enabled by default. It has effect only when after few async postbacks a full postback happened. Application has choice to persist ViewStates of all once selected and modified tabs or reset their view states and start LoadOnDemand from over again.
can you provide an example of a webtab using Async update panels on three tabs would like them to update only when changed.
thanks
Al
Hi Al,
I wrote for you a sample, which shows how to configure async postback and load on demand.
If you run that sample and look at generated html, then you will see content of selected (1st) tab item only. If you submit locally (button in content pane), then only content of that tab item will be submitted. If you change selected tab index on client, then content of that selected tab item will be loaded asynchronously and client will get contents of both tabs: initial and selected. At this point you will not find difference in generated html, though content of newly loaded tab item can be accessed by developer tools of browser. If you select 3rd tab item on client, then webtab will have contents of all 3 tab items. And so on. Local button clicks in contents of tab items will do async postbacks.
If you trigger full postback (Button4), then browser will lose contents of all tabs besides selected. That is definition of LoadOnDemand functionality. All possible client actions described above will start over again.
<ig:WebTab ID="WebTab1" runat="server" Width="300px" Height="300px"> <Tabs> <ig:ContentTabItem runat="server" Text="Tab 1"> <Template> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button1" /> </Template> </ig:ContentTabItem> <ig:ContentTabItem runat="server" Text="Tab 2"> <Template> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:Button ID="Button2" runat="server" Text="Button2" /> </Template> </ig:ContentTabItem> <ig:ContentTabItem runat="server" Text="Tab 3"> <Template> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> <asp:Button ID="Button3" runat="server" Text="Button3" /> </Template> </ig:ContentTabItem> </Tabs> <PostBackOptions EnableAjax="True" EnableLoadOnDemand="True" /></ig:WebTab><asp:Button ID="Button4" runat="server" Text="Button4" />
I had the code setup like you had it. I had webdatagrids instead of textboxes. If I go into all three tabs and go back to the first tab. The page tries to save all three grids after that. Not sure who to keep focus only on the first tab not the others after you active the other two in other words.
thanks for the quick reply.
When you select 2nd tab, then async postback should happen (to get content of 2nd tab) and server gets latest state of tab1. When you select 3rd tab, then async postback happens (to get content of 3rd tab) again. Though, if you after that will select 1st tab, then no postback should happen and I am not sure how at that point WebTab may trigger "saving three grids". The only guess I have, is that grid located on 3rd tab, has some specific settings which trigger automatic postback on lost focus or on some changes to it performed by client before switching back to 1st tab.
In order to better track server actions on various interactions on client, I suggest you to run application in debug mode, set break point within Page.OnLoad and check when it is hit when user changes tabs and do changes to grids.
Yes,
I am not sure at this point why the other two tabs are running the InitializeRow functions
<
PostBackOptions EnableAjax="true" EnableDynamicUpdatePanels="true" EnableAsyncUpdateAllTabs="true" >
I opened the page and it load all three tab grids. Then
when I updated a field on tab1, the process then updated all three grids. Not sure why.
Thanks for your help.
I guess that if a postback happens after you "updated a field on tab1", then that "field" probably has enabled AutoPostBack. If that field is part of grid, then probably grid has enabled autopostback flags or it has specific feature which triggers (internal async) postback.
If a postback happens for whatever reason (full by autopostback of field, async by WebTab, internal async by grid, etc.), then of course all controls located in already loaded tab items will be recreated on server and they will get/raise their server-initialization events. That is how server works and it is not possible to suppress or prevent that functionality. Attempt to defeat that functionality of server will destroy viewstate and probably will lead to exceptions later on.
To catch exact event-trigger for "undesired" postback, I suggested you to run page in debug mode. It should allow you to figure out that exact event and give you a chance to adjust logic and properties of that trigger to supress that action.