When I run the editor, the document loads and renders with the correct css markup in design mode. When I move the editor's cursor over the content area, the ApplyClass toolbar button displays the correct name of any class that happens to be under the cursor's position. But, when I expand the ApplyClass droplist, I find that it is empty with the exception of a single entry "Clear Class". The droplist does not contain any of the classes in the css files I've programatically added to the cssfiles property.
My understanding is that if the cssclasses property is set to be empty, the editor should automatically load all the class names contained in the files specified by cssfiles. I've done this too, but it didn't help. Do you know what's going wrong? I don't want to hardcode any class names as the css files are dynamically generated and will always be changing for each editing session.
I'm using Telerik RAD controls 2011.2.915.35 on windows 7 SP1 and am launching the page from inside of visual studio 2008 on the personal web browser.
The code in which I take a directory of the document folder and add all the css files found follows:
protected System.String loadCSS(System.String strFilePath, ref RadEditor radEditor)
{
System.String result = "OK";
try
{
if (strFilePath.IndexOf(":") < 0 && strFilePath.IndexOf("//") < 0)
{
strFilePath = Server.MapPath(strFilePath);//its a virtual path so map it to a physical one
}
System.String strPublishingFolder = Path.GetDirectoryName(strFilePath);
foreach (System.String strCSSfile in Directory.GetFiles(strPublishingFolder, "*.css"))
{
radEditor.CssFiles.Add(strCSSfile);
}//EOF strCSSfile in Directory.GetFiles
radEditor.CssClasses.Add("", "");
}
catch (Exception ex)
{
System.Object oe = (Object)ex;
result = "loadCSS: " + et.rptError(ref oe);
}//try
return result;
}//EOF loadCSS
The rad editor control markup is:
<telerik:RadEditor ID="telerikeditor" Runat="server" OnClientLoad="onClientLoad" OnClientCommandExecuting="OnClientCommandExecuting"> <Tools> <telerik:EditorToolGroup Tag="grpInputOutput"> <telerik:EditorTool ImageUrl="Images/radeditorSave.gif" Name="Save" ShowText="False" Text="Save" /> <telerik:EditorTool ImageUrl="Images/radeditorSaveAs.gif" Name="SaveAs" ShowText="False" Text="Save As" /> <telerik:EditorSeparator /> <telerik:EditorTool Name="PageProperties" /> <telerik:EditorTool Name="Print" /> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpAids"> <telerik:EditorTool Name="Help" /> <telerik:EditorDropDown Name="Zoom"></telerik:EditorDropDown> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpCheckers"> <telerik:EditorTool Name="AjaxSpellCheck" /> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpFind"> <telerik:EditorTool Name="FindAndReplace" /> <telerik:EditorTool Name="SelectAll" /> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpRecover"> <telerik:EditorSplitButton Name="Undo"></telerik:EditorSplitButton> <telerik:EditorSplitButton Name="Redo"></telerik:EditorSplitButton> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpCutNpaste"> <telerik:EditorTool Name="Cut" /> <telerik:EditorTool Name="Copy" /> <telerik:EditorTool Name="Paste" ShortCut="CTRL+V" /> <telerik:EditorSeparator /> <telerik:EditorTool Name="PasteFromWord" /> <telerik:EditorTool Name="StripWord" /> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpInsert"> <telerik:EditorTool Name="InsertParagraph" /> <telerik:EditorSplitButton Name="InsertSymbol"></telerik:EditorSplitButton> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpTextFont"> <telerik:EditorDropDown Name="FormatBlock"></telerik:EditorDropDown> <telerik:EditorDropDown Name="FontName"></telerik:EditorDropDown> <telerik:EditorDropDown Name="RealFontSize"></telerik:EditorDropDown> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpMarkup"> <telerik:EditorTool Name="ApplyClass"></telerik:EditorTool> <telerik:EditorTool Name="Bold" /> <telerik:EditorTool Name="Italic" /> <telerik:EditorTool Name="Underline" /> <telerik:EditorTool Name="ConvertToLower" /> <telerik:EditorTool Name="ConvertToUpper" /> <telerik:EditorTool Name="InsertHorizontalRule" /> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpAlignment"> <telerik:EditorTool Name="JustifyLeft" /> <telerik:EditorTool Name="JustifyCenter" /> <telerik:EditorTool Name="JustifyRight" /> <telerik:EditorTool Name="JustifyFull" /> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpLists"> <telerik:EditorTool Name="InsertOrderedList" /> <telerik:EditorTool Name="InsertUnorderedList" /> <telerik:EditorSeparator /> <telerik:EditorTool Name="Indent" /> <telerik:EditorTool Name="Outdent" /> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpImages"> <telerik:EditorTool Name="InsertImage" /> <telerik:EditorTool Name="ImageManager" ShortCut="CTRL+M" /> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="grpCalendar"> <telerik:EditorTool Name="InsertDate" /> <telerik:EditorTool Name="InsertTime" /> </telerik:EditorToolGroup> </Tools> <Content> </Content> </telerik:RadEditor>