RadEditor for ASP.NET

Colors Send comments on this topic.
See Also
DropDowns > Colors

Glossary Item Box



The Colors dropdown of Telerik RadEditor displays a predefined set of colors by default. All colors are held in the Colors Collection. You can easily modify this default set or add a new color using the Add method for this collection:

ASPX Copy Code
<rad:RadEditor id="RadEditor1" Runat="server"></rad:RadEditor>
C# Copy Code
RadEditor1.Colors.Add("#FF8C00");
RadEditor1.Colors.Add(
"red");
RadEditor1.Colors.Add(
"#9900CC");
VB.NET Copy Code
RadEditor1.Colors.Add("#FF8C00")
RadEditor1.Colors.Add("red")
RadEditor1.Colors.Add("#9900CC")
Please, bear in mind that Telerik RadEditor will persist its state (including the Colors set) between postbacks. In order to create a new set of Colors (e.g. for different users), you will need to clear it first. This can be done using the Remove method for the Colors collection

To ensure design consistency, you can prohibit the use of custom colors by setting the AllowCustomColors property to false. This will hide the "Add Custom Color" and "Add Hex Color" buttons.

When using the Add method the Colors dropdown will be reset, so the colors you add will not be appended to the default set, but will rather create a new Colors set. See the example below:

 

Default state

No custom colors

Programmatic population

 


(The Colors dropdown contains
the default set of colors)
 


(AllowCustomColors=false)
 


(The Colors dropdown contains only those
added using the AddForeColor and
AddBackColor
methods)(AllowCustomColors=false)

 

You can also populate the color dropdowns using the ToolsFile, as shown in the example below:

ToolsFile.xml Copy Code
<colors>
  
<color value="#FF00EE" />
  
<color value="#840012" />
  
<color value="#0000AA" />
  
<color value="#95AA34" />
</
colors>

 

Please, note that you can add one color at a time.

 

See Also