Re: "File Browsing has been blocked." inside AJAX TabContainer

  •  12-18-2008, 11:34 AM

    Re: "File Browsing has been blocked." inside AJAX TabContainer

    Hi,
     
    I have wrote a temporary code for your condition. We will embed this way into the uploader for next release.
     
    Please try this now :
     

    <%@ Page Language="VB" AutoEventWireup="false" %>

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
     <title></title>
    </head>
    <body>
     <form id="form1" runat="server">
      <asp:ScriptManager ID="ScriptManager1" runat="Server" />
      <ajaxToolkit:TabContainer ID="TabContainer1" runat="server">
       <ajaxToolkit:TabPanel ID="Panel1" runat="server" HeaderText="Panel1">
        <ContentTemplate>
         Click on Panel2 and then on Upload
        </ContentTemplate>
       </ajaxToolkit:TabPanel>
       <ajaxToolkit:TabPanel ID="Panel2" runat="server" HeaderText="Panel2">
        <ContentTemplate>
         <CuteWebUI:Uploader runat="server" ID="Uploader1" MultipleFilesUpload="true" InsertText="Upload"
          UploadType="Flash">
          <ValidateOption MaxSizeKB="10240" />
         </CuteWebUI:Uploader>
        </ContentTemplate>
       </ajaxToolkit:TabPanel>
      </ajaxToolkit:TabContainer>
      <br />
      <asp:Button ID="button1" runat="server" Text="Postback" />
     </form>

     <script>
     var theuploader=document.getElementById("<%=Uploader1.ClientID %>");
     var thebutton;
     var theflashdiv;
     var theflashobj;
     var laststatus="";
     function CuteWebUI_AjaxUploader_OnMantleButton(button,flashdiv)
     {
      thebutton=button;
      theflashdiv=flashdiv;
      theflashobj=flashdiv.firstChild;
      //use this line to see the floating flash object
      //flashdiv.style.backgroundColor="red";
     }
     function checkbutton()
     {
      if(!thebutton)return;
      var nowstatus="visible";
      for(var n=thebutton;n!=null&&n.style!=null;n=n.parentNode)
      {
       if(n.style.display=='none')
       {
        nowstatus="none";
       }
      }
      if(nowstatus!=laststatus)
      {
       laststatus=nowstatus;
       if(laststatus=="visible")
       {
        theflashdiv.style.display="";
        var pos=CalcPosition(theflashdiv,thebutton);
        theflashdiv.style.left=pos.left+"px";
        theflashdiv.style.top=pos.top+"px";
        theflashdiv.style.width=theflashobj.style.width=thebutton.offsetWidth+"px";
        theflashdiv.style.height=theflashobj.style.height=thebutton.offsetHeight+"px";
        theflashdiv.style.zIndex=12345672;
       }
       else
       {
        theflashdiv.style.display="none";
       }
      }
     }
     setInterval(checkbutton,100);
     </script>

     <script>


     //get the position of a element ( by the scroll offset )
     function GetScrollPostion(e)
     {
      var b=window.document.body;
      var p=b;
      if(window.document.compatMode=="CSS1Compat")
      {
       p=window.document.documentElement;
      }
      
      if(e==b)return {left:0,top:0};

      //if(e.getBoundingClientRect)
      //{
      // var b=e.getBoundingClientRect();
      // return {left:p.scrollLeft+b.left,top:p.scrollTop+b.top};
      //}

      var l=0;
      var t=0;
      var box;
      var offset;

      l = e.offsetLeft;
      t = e.offsetTop;
      offset = e.offsetParent;
      if (offset != e) {
       while (offset) {
        l += offset.offsetLeft;
        t += offset.offsetTop;
        offset = offset.offsetParent;
       }
      }
      if (window.opera) {
       offset = e.offsetParent;
       while (offset && offset.tagName.toUpperCase() != "BODY" && offset.tagName.toUpperCase() != "HTML") {
        l -= offset.scrollLeft;
        t -= offset.scrollTop;
        offset = offset.offsetParent;
       }
      }
      else {
       offset = e.parentNode;
       while (offset && offset.tagName.toUpperCase() != "BODY" && offset.tagName.toUpperCase() != "HTML") {
        l -= offset.scrollLeft;
        t -= offset.scrollTop;
        offset = offset.parentNode;
       }
      }
      return {left:l,top:t}
     }
     //get the position of a element ( by the client offset )
     function GetClientPosition(e)
     {
      var b=window.document.body;
      var p=b;
      if(window.document.compatMode=="CSS1Compat")
      {
       p=window.document.documentElement;
      }
      
      if(e==b)return {left:-p.scrollLeft,top:-p.scrollTop};
      
      if(e.getBoundingClientRect)
      {
       var b=e.getBoundingClientRect();
       return {left:b.left-p.clientLeft,top:b.top-p.clientTop};
      }
      
      var l=0;
      var t=0;
      for(var e1=e;e1!=null&&e1!=b;e1=e1.offsetParent)
      {
       l+=e1.offsetLeft;
       t+=e1.offsetTop;
      }
      return {left:l-p.scrollLeft,top:t-p.scrollTop}
     }
     //get absolute or relative parent
     function GetStandParent(e)
     {
      if(e.currentStyle)
      {
       for(var pe=e.parentElement;pe!=null;pe=pe.parentElement)
       {
        var sp=pe.currentStyle.position;
        if(sp=="absolute"||sp=="relative")
         return pe;
       }
      }
      else
      {
       var view=e.ownerDocument.defaultView;
       for(var pe=e.parentNode;pe!=null&&pe.nodeType==1;pe=pe.parentNode)
       {
        var sp=view.getComputedStyle(pe, "").getPropertyValue("position")
        if(sp=="absolute"||sp=="relative")
         return pe;
       }
      }
      return (e.ownerDocument||e.document).body;
     }
     //calc the position of floate that relative to e
     function CalcPosition(floate,e)
     {
      var epos=GetScrollPostion(e);
      var spos=GetScrollPostion(GetStandParent(floate));
      var s=GetStandParent(floate);
      var pos={left:epos.left-spos.left-(s.clientLeft||0),top:epos.top-spos.top-(s.clientTop||0)};
      return pos
     }

     </script>

    </body>
    </html>

     
    Regards,
    Terry
     
View Complete Thread