Re: code to drop an image from images dropdown

  •  04-14-2010, 12:00 AM

    Re: code to drop an image from images dropdown

    oompah:
    I am trying to use the code to do it programtically but no matter what I do it still leaves your default logo and flower image in there.
     
    I assume programtically setting this I do not need to edit the Common.config file or do i need to do both
     
    here is my code
     
     
    Dim dropdown As CuteEditor.RichDropDownList
                Dim richitem As CuteEditor.RichListItem
                dropdown = DirectCast(cutefile.ToolControls("Images").Control, CuteEditor.RichDropDownList)
                richitem = dropdown.Items(0)
                dropdown.Items.Clear()
                dropdown.Items.Add(richitem)
                dropdown.Items.Add("Welcome", "<img src=" & Chr(34) & "images/Title-Welcome.gif" & Chr(34) & " alt=" & Chr(34) & "" & Chr(34) & " />")
     
    I also tried replaceing the chr(34) in the alst line with a single apostrophe - you can not put a double quote in there in vb it will cause a non valid string compiler error - you may want to alter that in the help file you referenced above.
     
    Please advise
     
     
     
     
     
    Hi oompah,
     
    Try this example
     
    1. <%@ Page Language="VB" %>   
    2.   
    3. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>   
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
    5.   
    6. <script runat="server">   
    7.     Protected Overloads Overrides Sub OnLoad(ByVal e As EventArgs)   
    8.         If Not IsPostBack Then  
    9.             Dim toolctrl As CuteEditor.ToolControl = editor1.ToolControls("Images")   
    10.             If toolctrl IsNot Nothing Then  
    11.                 Dim dropdown As CuteEditor.RichDropDownList = DirectCast(toolctrl.Control, CuteEditor.RichDropDownList)   
    12.                 'the first item is the caption    
    13.                 Dim richitem As CuteEditor.RichListItem = dropdown.Items(0)   
    14.                 'clear the items from configuration files    
    15.                 dropdown.Items.Clear()   
    16.                 'add the caption    
    17.                 dropdown.Items.Add(richitem)   
    18.                 'add text and value    
    19.                 dropdown.Items.Add("Logo""<img src='Uploads/10n2.jpg'/>")   
    20.                 'add html and text and value    
    21.                 dropdown.Items.Add("<img src='Uploads/12.jpg' /> ""Flower""<img src='Uploads/12.jpg'/>")   
    22.             End If  
    23.         End If  
    24.         MyBase.OnLoad(e)   
    25.     End Sub  
    26. </script>   
    27.   
    28. <html xmlns="http://www.w3.org/1999/xhtml">   
    29. <head runat="server">   
    30.     <title>Untitled Page</title>   
    31. </head>   
    32. <body>   
    33.     <form id="form1" runat="server">   
    34.         <div>   
    35.             <CE:Editor ID="editor1" runat="server">   
    36.             </CE:Editor>   
    37.         </div>   
    38.     </form>   
    39. </body>   
    40. </html>  
    Regards,
     
    Ken
View Complete Thread