Re: Possible to use Image Gallery and Image Upload without Cute Editor?

  •  06-17-2009, 2:48 AM

    Re: Possible to use Image Gallery and Image Upload without Cute Editor?

    Hi debierman,
     
    Try this example
     
    1. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>   
    2.   
    3. <%@ Page Language="C#" %>   
    4.   
    5. <html>   
    6. <head>   
    7.     <title>ASP and ASP.NET WYSIWYG Editor - Use CuteEditor as an image selector</title>   
    8. </head>   
    9. <body>   
    10.     <form runat="server">   
    11.         <table border="0" cellpadding="0" cellspacing="0">   
    12.             <tr>   
    13.                 <td width="10" nowrap>   
    14.                 </td>   
    15.                 <td width="20" nowrap>   
    16.                 </td>   
    17.                 <td valign="top" width="760">   
    18.                     <b>Use CuteEditor as an image selector</b>   
    19.                     <hr>   
    20.                     This example demonstrates how to use CuteEditor as an image selector.   
    21.                     <br>   
    22.                     <br>   
    23.                     <asp:TextBox ID="imageFld" Width="300" runat="server" />   
    24.                     <input type="button" value="Change Image" onclick="callInsertImage()" id="Change"  
    25.                         runat="server" name="Change">   
    26.                     <div>   
    27.                         <CE:Editor ID="Editor1" runat="server" Width="1" Height="1" AutoConfigure="None"  
    28.                             ShowHtmlMode="False" ShowPreviewMode="False" EnableContextMenu="false" ShowGroupMenuImage="False"  
    29.                             ShowBottomBar="False" BackColor="White" BorderColor="White">   
    30.                         </CE:Editor>   
    31.                         <br>   
    32.                     </div>   
    33.                 </td>   
    34.                 <tr>   
    35.                 </tr>   
    36.         </table>   
    37.     </form>   
    38.   
    39.     <script language="javascript">    
    40.     function callInsertImage()     
    41.     {     
    42.             var editor1 = document.getElementById('<%=Editor1.ClientID%>');   
    43.             editor1.FocusDocument();     
    44.             var editdoc = editor1.GetDocument();     
    45.             editor1.ExecCommand('new');   
    46.             editor1.ExecCommand('InsertImage');   
    47.             InputURL();   
    48.     }       
    49.        
    50.     function InputURL()   
    51.     {    
    52.         var editor1 = document.getElementById('<%=Editor1.ClientID%>');   
    53.         var editdoc = editor1.GetDocument();     
    54.         var imgs = editdoc.images;   
    55.         if(imgs.length>0)     
    56.         {   document.getElementById("imageFld").value = imgs[imgs.length-1].src;   
    57.             editor1.ExecCommand('new');   
    58.             document.getElementById("imageFld").focus();    
    59.         }     
    60.         else  
    61.         {   
    62.             setTimeout(InputURL,500);    
    63.         }     
    64.     }          
    65.     </script>   
    66.   
    67. </body>   
    68. </html>  

    Regards,
     
    Ken
View Complete Thread