flajaxian object inside Ajax Control Tookit TabContainers

Feb 21, 2008 at 12:26 PM
Hello Flajaxian.

I posted this within another discussion. If you place a flajaxian upload inside a tab panel you will receive a javascript object error and afterwards a message will be displayed that invites you to download another browser / flash plugin stating that "your browser doesn't support external flash plugin".

It would be great to have the flajaxian object available in all page design contexts. I've only tested this with tab containers but I guess that it affects other contexts too.

Coordinator
Feb 24, 2008 at 3:44 AM
Edited Feb 24, 2008 at 3:45 AM
The problem is that at the moment of initialization flash object is invisible and the flash - javascript bridge (so called ExternalInterface) cannot be initialized. That's why after the revision 8563 was introdused deleyed initialization. That means that the code will not be initialized as usual on window load. But whenever you make it visible for the first time. For example in the case of ajax toolkit tabs you can use it this way:
1. Add the property DoNotInitializeJavascript="true" so your tags can look kike that

<fjx:FileUploader ID="FileUploader1" DoNotInitializeJavascript="true" runat="server" >
<Adapters>
<fjx:FileSaverAdapter Runat="server" FolderName="UploadFolder" />
</Adapters>
</fjx:FileUploader>
2. At to the tab containing FileUploader OnClientClick="InitFileUploader" so it can look like:
<ajaxToolkit:TabPanel runat="server" ID="Panel3" HeaderText="Email" OnClientClick="InitFileUploader" >
<ContentTemplate>

3. At the bottom of the page add this script:
<script type="text/javascript">
window.fileUploaderIsInitialized = false;
if($get('<%=this.TabsControl.Tabs[1].ClientID %>').style.display != 'none'){
InitFileUploader();
}
function InitFileUploader(){
if(window.fileUploaderIsInitialized){ return; }
<%=this.TabsControl.Tabs[1].FindControl("FileUploader1").ClientID%>_initialize();
window.fileUploaderIsInitialized = true;
}
</script>

assuming that the FileUploader is in your second tab this.TabsControl.Tabs[1]

Feb 24, 2008 at 10:08 AM
Thanks, great. I haven't seen this.