I wanted to get some clarification on the LoadOnDemand feature of WebTab. When AsyncMode=On and EnableLoadOnDemand=True, it seems that WebTab only returns html for the selected tab as expected. However, when stepping through the code in debug mode, it appears that each usercontrol is still run on the server side with each tab click.
<igtab:UltraWebTab ID="tabDevice" runat="server" TabOrientation="LeftTop" BarHeight="0" LoadAllTargetUrls="False" Width="100%" AsyncMode="On" > <asyncoptions EnableLoadOnDemand="true"/> <Tabs> <igtab:Tab Text="UC 1" AsyncOption="LoadOnDemand" Key="MyTab1"> <ContentPane UserControlUrl="deviceModules/deviceUC.ascx" /> </igtab:Tab> <igtab:TabSeparator/> <igtab:Tab Text="UC 2" AsyncOption="LoadOnDemand" Key="MyTab2"> <ContentTemplate> <uc1:deviceUC ID="tab2UC" runat="server" /> </ContentTemplate> </igtab:Tab> </Tabs></igtab:UltraWebTab>
Hi,
That is correct, on any postback (full or async) all child controls in all tabs are recreated. Otherwise, viewstate will be lost.
It is possible to build application which will load a single selected tab. Yes, that will dramatically reduce size of html and speed up application, but that requires so much coding and it will be so potentially buggy, that hardly anybody can go that way.
Below are approximate steps to implement loading content of only selected tab manually:
1. <%@ Page ... EnableEventValidation="false" %>2. In aspx: remove all child controls from tabs.3. Create storage of data of every field which is located in every tab as child control. That storage should contain pairs of ChildField.UniqueID and ChildField.Text (assuming that is TextBox. In case of other more complex controls more work and more complex storage is required). That storage can be Session, database or similar static thing.4. Fill that storage on initialization of application (all fields in all tabs).5. Create storage of tab index selected in previous postback. For example: Session["oldTab"] = this.UltraWebTab1.SelectedTabIndex;6. Process Page.OnLoad (or similar event) and do following7. For currently selected tab: a) Load content of tab (UserControl or similar). b) Save value of currently selected tab (step 5). c) Fill values of pairs ChildField.UniqueID and ChildField.Text for fields located in that tab. d) Note: Those values (especially UniqueID) will be used after postback to get updated ChildField.Text.8. For previously selected tab (tab which has fields modified by user): a) To get index of that tab (use value which was saved in step 5) b) Use ChildField.UniqueID which was saved in previous postback to get new value from this.Request.Form. c) Update value of ChildField.Text in your storage (Session or database) with new value obtained from Form. d) If you need to process server events of child controls, then you may check value of __EVENTTARGET in Form. That value should contain UniqueID of control which raised postback. The __EVENTARGUMENT will provide additional information.
Viktor,
I have a situation where the form is submitted, then the info is collected (number of selected rows in the ultrawebgrid) and then the form is resubmitted via javascript (form.submit) upon "OK" from a javascript Confirm.
Once the form is submitted with JavaScript the UltraWebTab loses its SelectedTabIndex, although the ultrawebtab EnableViewState is set to True.
To be more precise, the SelectedTabIndex is shown = -1, but then when I view the UltraWebTab object in the Watch window, the SelectedTabIndex is shown correctly, but this is not helpful when the program runs on its own, i.e. not in the debug mode. All on its own the SelectedTabIndex = -1 . Since SelectedTabIndex is determining the logic, it is important to be have its actual value.
Thank you!
In order to help you, I need a simple sample which can be used to reproduce behavior which you refer to. If it is possible to build a simple example (maybe without grid), then please zip aspx/cs files and attach to Options tab.
Hi Victor,
Thank you for helping me.
I sent you 2 files aspx and aspx.cs. If you put break point at line 1499, you'll see the problem right away.
dashboardTabs.SelectedTabIndex=-1, but it should be in range of 0-4
I can not see your attachment. Did you submitted a case or used Options tab?
thank you for following up. I store the current tab name in the hidden field on the client event 'AfterSelectedTabChange' to work around what seems to be a bug.