CuteEditor for .NET

Images dropdown Customization

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:


<Images >

    <item text="Logo">

         <value><![CDATA[

                         <img border="0" src="http://www.cutesoft.net/images/logo.gif" />

                   ]]>

         </value>

         <html><![CDATA[

                       <img border=0 align='absMiddle' src='http://cutesoft.net/data/logo_s.gif' /> Company logo

                  ]]>

        </html>

    </item>

    <item text="Flower">

        <value><![CDATA[

                    <img border="0" src="http://cutesoft.net/data/j0313820.jpg" />

                 ]]>
        </value>

        <html><![CDATA[

                  <img border=0 align='absMiddle' src='http://cutesoft.net/data/flower_s.gif' /> Flower

                ]]>

        </html>

    </item>

</Images>

Now the Images dropdown contains the followings:




 

 


2: Programmatically populate the Images dropdown

C# Example:

if (!IsPostBack) { 
CuteEditor.ToolControl toolctrl=Editor1.ToolControls["Images"];
if(toolctrl!=null) {
CuteEditor.RichDropDownList dropdown=(CuteEditor.RichDropDownList)toolctrl.Control;
//the first item is the caption
CuteEditor.RichListItem richitem=dropdown.Items[0];
//clear the items from configuration files
dropdown.Items.Clear();
//add the caption
dropdown.Items.Add(richitem);
//add text and value
dropdown.Items.Add("Logo","<img border="0" src="http://www.cutesoft.net/images/logo.gif"/>");
//add html and text and value
dropdown.Items.Add("<img border=0 align='absMiddle' src='http://cutesoft.net/data/flower_s.gif' /> Flower","Flower","<img border="0" src="http://cutesoft.net/data/j0313820.jpg"/>");
}
}


VB Example:

If Not Page.IsPostBack Then
  If Not Editor1.ToolControls("Images") Is Nothing Then

      Dim dropdown As CuteEditor.RichDropDownList
      Dim richitem As CuteEditor.RichListItem

      dropdown = DirectCast(Editor1.ToolControls("Images").Control, CuteEditor.RichDropDownList)

      'the first item is the caption
      richitem = dropdown.Items(0)

      'clear the items from configuration files
      dropdown.Items.Clear()

      'add the caption
      dropdown.Items.Add(richitem)
     'add text and value
      dropdown.Items.Add("Logo","<img border="0" src="http://www.cutesoft.net/images/logo.gif" />")

      'Add html and text and value
      dropdown.Items.Add("<img border=0 align='absMiddle' src='http://cutesoft.net/data/flower_s.gif' /> Flower", "Flower", "<img border="0" src="http://cutesoft.net/data/j0313820.jpg" />")

  End If
End If