Re: File picker not working.

  •  05-05-2009, 12:59 PM

    Re: File picker not working.

    Please try the following code:
     
    1. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>   
    2. <%@ Page Language="C#"%>   
    3. <HTML>   
    4.     <body>   
    5.         <form runat="server">            
    6.                         <input name="docFld" type="text" id="docFld" style="width:300px;" />    
    7.                         <input name="Change" id="Change" type="button" value="File Manager" onclick="PickFile()" />       
    8.                            
    9.                         <div>   
    10.                             <CE:Editor id="Editor1" runat="server" Width="1" Height="1" AutoConfigure="None" ShowHtmlMode="False" ShowPreviewMode="False" EnableContextMenu="false" ShowGroupMenuImage="False" ShowBottomBar="False" BackColor="White" BorderColor="White"></CE:Editor><br>   
    11.                         </div>   
    12.                        
    13.         </form>   
    14.     
    15. <Script Language="javascript">   
    16.     function PickFile()     
    17.     {     
    18.             var editor1 = document.getElementById('<%=Editor1.ClientID%>');   
    19.             editor1.FocusDocument();     
    20.             var editdoc = editor1.GetDocument();     
    21.             editor1.ExecCommand('new');   
    22.             editor1.ExecCommand('insertdocument');   
    23.             InputURL();   
    24.             document.getElementById("docFld").focus();    
    25.     }       
    26.        
    27.     function InputURL()   
    28.     {    
    29.         var editor1 = document.getElementById('<%=Editor1.ClientID%>');   
    30.         var editdoc = editor1.GetDocument();     
    31.         var links = editdoc.getElementsByTagName("a");          
    32.         if(links.length>0&&links[links.length-1].href!="")     
    33.         {   document.getElementById("docFld").value = links[links.length-1].href;          
    34.         }     
    35.         else  
    36.         {   
    37.             setTimeout(InputURL,500);    
    38.         }      
    39.     }         
    40. </script>    
    41.   
    42.     </body>   
    43. </HTML>  

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread