CuteEditor for .NET

Images dropdown Customization

The Images dropdown of CuteEditor by default displays a predefined set of Images. You can easily modify this default set using the following methods.

1. Edit Dropdown Configuration File (Common.config).

The dropdown configuration file (Common.config) can be found in the /CuteEditor/Configuration/Shared folder. In dropdown configuration file you can find the Images element which contains the configuration information for the Images dropdown within Cute Editor. You can modify the Images element to create your own Images list.

Example:

  1. <Images>  
  2.    <item text="Logo">
  3.         <value><![CDATA[<img border="0" src="http://www.cutesoft.net/images/logo.gif" />]]></value>  
  4.         <html><![CDATA[<img border='0' src='http://cutesoft.net/data/logo_s.gif' /> Company logo]]></html>  
  5.    </item>  
  6.    <item text="Flower">  
  7.         <value><![CDATA[<img border="0" src="http://cutesoft.net/data/j0313820.jpg" />]]></value>  
  8.         <html><![CDATA[<img border='0' src='http://cutesoft.net/data/flower_s.gif' /> Flower]]></html>  
  9.    </item>  
  10. </Images>  

Now the Images dropdown contains the followings:



2. Programmatically populate the Images dropdown

C# Example:


  1. if (!IsPostBack) {    
  2.    CuteEditor.ToolControl toolctrl=Editor1.ToolControls["Images"];    
  3.    if(toolctrl!=null) {    
  4.       CuteEditor.RichDropDownList dropdown=(CuteEditor.RichDropDownList)toolctrl.Control;    
  5.       //the first item is the caption    
  6.       CuteEditor.RichListItem richitem=dropdown.Items[0];    
  7.       //clear the items from configuration files    
  8.       dropdown.Items.Clear();    
  9.       //add the caption   
  10.        dropdown.Items.Add(richitem);   
  11.       //add text and value    
  12.       dropdown.Items.Add("Logo","<img src="http://www.cutesoft.net/images/logo.gif"/>");    
  13.       //add html and text and value    
  14.       dropdown.Items.Add("<img src='http://cutesoft.net/data/flower_s.gif' /> Flower","Flower","<img src="http://cutesoft.net/data/j0313820.jpg"/>");    
  15.    }    
  16. }  

VB Example:


  1. If Not Page.IsPostBack Then  
  2.   If Not Editor1.ToolControls("Images"Is Nothing Then  
  3.       Dim dropdown As CuteEditor.RichDropDownList   
  4.       Dim richitem As CuteEditor.RichListItem   
  5.       dropdown = DirectCast(Editor1.ToolControls("Images").Control, CuteEditor.RichDropDownList)   
  6.       'the first item is the caption   
  7.       richitem = dropdown.Items(0)   
  8.       'clear the items from configuration files   
  9.       dropdown.Items.Clear()   
  10.       'add the caption   
  11.       dropdown.Items.Add(richitem)   
  12.       'add text and value   
  13.        dropdown.Items.Add("Logo","<img src="http://www.cutesoft.net/images/logo.gif" />")   
  14.       'Add html and text and value   
  15.       dropdown.Items.Add("<img src='http://cutesoft.net/data/flower_s.gif' /> Flower""Flower""<img src="http://cutesoft.net/data/j0313820.jpg" />")   
  16.   End If  
  17. End If