I am having difficulty with the WebTab EnableLoadOnDemandURL capability.
I feel pretty foolish that I can't seem to figure this out... It seems like such a basic thing. I feel like I am missing something fundamental about WebTab implementation... especially since this is so easy to accomplish in UltraWebTab.
I have two ContentURL tabs.
EnableLoadOnDemandURL is set to "True".
When I click on each tab initially, I can see the content load in, and all is good. If I then navigate back to the data entry tab, and make changes. Then I navigate back to the "Print Friendly" tab (for a second time), the "Print Friendly" page does not reload. I have ruled out browser caching.
The behavior I am looking for is this: When you click the tab to navigate to the tab, the tab content URL should reload.
I thought that maybe the "EnableReloadingOnTabClick" property would give me the answer... but it only reloads the page if you click on the currently selected tab. So, if I a currently have Tab1 selected, and then I click on Tab1, then Tab1 will reload. However... if I currently have Tab1 selected, and I click Tab2 to navigate to it, Tab2 is not reloaded... despite the "EnableReloadingOnTabClick" value.
I know there's probably some really simple answer that will make me feel tremendously stupid, and I hope y'all can give it to me!
Hi Rob,
The EnableLoadOnDemandUrl is design to avoid loading iframes of all tabs on initial load (or after a full postback). Once url is loaded it stays loaded.There is no option like EnableLoadUrlOfOnlySelectedTab.
Though it is can be implemented by application while processing selected tab events. The SelectedIndexChanging event is raised before new tab is selected and provides index of that tab. So, application may process that event and remove current url/src from that tab. WebTab checks/validates src of iframe after tab was selected, and if it is different from ContentUrl property, then url is loaded. Below is example:
<script type="text/javascript">function WebTab1_SelectedIndexChanging(sender, eventArgs){ var index = eventArgs.get_tabIndex(); // check if url of that tab should be reloaded if(index != 0 && index != 1) return; var tab = sender.getTabAt(index); var iframe = tab.get_iframe(); // remove current url/src from iframe. // you can use any "reset" value, though BLOCKED SCRIPT"" is preferrable if(iframe) iframe.src = 'BLOCKED SCRIPT""';}</script><ig:WebTab ID="WebTab1" runat="server" ...> ... <ClientEvents SelectedIndexChanging="WebTab1_SelectedIndexChanging" /> <PostBackOptions EnableLoadOnDemandUrl="True" /></ig:WebTab>
Hi Viktor. What if the tab that needs to be reloaded is a UserControlUrl not a ContentUrl. When using your method above, I'm having trouble trying to find how to reset the UserControlUrl as the tab contains a div not an iframe for user controls.
Thanks!
Viktor, absolutely perfect! I use iFrames pretty heavily inside the tabs, and this is a recurring issue on several of my pages. This effectively solves the problem.
Thanks! You are the guru!
-Rob