This is a migrated thread and some comments may be shown as answers.

RadEditor custom button icon problems

2 Answers 203 Views
Editor
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 2
George asked on 27 Apr 2016, 05:54 PM

I have read many posts, samples, and crappy documentation and almost got a custom dialog working.  With the change from  to  figuring out things are quite impossible to figure out with samples and documentation not being up to date.  I created the custom dialogs using a RadWindow which is working functionally the custom button/dialogs are working fine but icons are frustrating.

I want to add two buttons and insert dialogs. I started with adding a group and buttons to the tools XML file.

 

<tools name="Messages" tab="Home">
  <tool name="MessagesTags" size="large" text="Tags" showicon="false" showtext="true" />
  <tool name="MessagesDates" size="large" text="Dates" showicon="false" showtext="true" />
</tools>

 

The buttons show up fine. "Show icons" is false because I gave up trying to show the icon but that does not work, the default icon continues to show up.

I have a master asp.net project so I put the styles in the file, I did try the master file. This is at the top of my  file just under <Content>.

 

<style>   
   .reToolbar.Default .MessagesTags {
        background-image:  url(http://www.moredogz.com/images/MoreDogzLogoSmall.gif);
    }
    .reToolbar.Default .MessagesDates {
        background-image:  url(http://www.moredogz.com/images/MoreDogzLogoSmall.gif);
    }
</style>

 

My icon if logo from another website of mine, the one used in the Telerik forum example zip is gone.

From other suggestions and a Telerik example project I tried several different web.config settings.  My RadEditor declaration is primarily done from code.

<telerik:RadEditor  ID="EmailBody" runat="server" EnableEmbeddedScripts="true"></telerik:RadEditor>

public enum RadEditorType {Normal, Messages}
 public static void UpdateRadEditor(RadEditorType type, RadEditor textEditor, int orgNumber, HttpServerUtility server)
 {      
     string folder =  "~/Organizations/Org" + orgNumber.ToString();
     string serverFolder = server.MapPath(folder);
     if(!Directory.Exists(serverFolder)) {
         Directory.CreateDirectory(serverFolder);
     }
     folder += "/";
     textEditor.ToolbarMode = Telerik.Web.UI.EditorToolbarMode.RibbonBar;
     textEditor.Skin = "Default";
     if (type == RadEditorType.Messages) {
         textEditor.ToolsFile = "~/Files/REditorToolsMessages.xml";
     }
     else {
         textEditor.ToolsFile = "~/Files/REditorTools.xml";
     }
     textEditor.CssClass = "centered-editor";
     textEditor.DialogHandlerUrl = "~/Telerik.Web.UI.DialogHandler.axd";
     textEditor.SpellCheckSettings.AjaxUrl = "/Telerik.Web.UI.SpellCheckHandler.axd";
     textEditor.TrackChangesSettings.CanAcceptTrackChanges = false;
     textEditor.ExternalDialogsPath = "~/RadEditorDialogs";
     textEditor.ImageManager.MaxUploadFileSize = 1024000;
     textEditor.ImageManager.ViewPaths = new string[] { folder };
     textEditor.ImageManager.UploadPaths = new string[] { folder };
     textEditor.ImageManager.DeletePaths = new string[] { folder };
     textEditor.ImageManager.EnableAsyncUpload = true;
     textEditor.ImageManager.MaxUploadFileSize = 1024000;
     textEditor.MediaManager.ViewPaths = new string[] { folder };
     textEditor.MediaManager.UploadPaths = new string[] { folder };
     textEditor.MediaManager.DeletePaths = new string[] { folder };
     textEditor.MediaManager.EnableAsyncUpload = true;
 }

The EnableEmbeddedScripts scripts setting is a web.config setting from the example.

I do not know what to try next.

 

 

2 Answers, 1 is accepted

Sort by
0
George
Top achievements
Rank 2
answered on 29 Apr 2016, 04:28 PM

I submitted a ticket and got suggestions that did not help but it did lead me to discover that the EditorTool class under RadEditor has URL properties that I managed to set in C# code.  My toolbar is first with two buttons.

 

textEditor.ToolsFile = "~/Files/REditorToolsMessages.xml";
EditorTool tool = (EditorTool) textEditor.Tools[0].Tools[0];
tool.ImageUrl = "~/Images/TagsSmallICon.png";
tool.ImageUrlLarge  = "~/Images/TagsIcon.png";
tool = (EditorTool) textEditor.Tools[0].Tools[1];
tool.ImageUrl = "~/Images/DateSmallIcon.png";
tool.ImageUrlLarge  = "~/Images/DatesIcon.png";

 


It did get me to read the information that I had already tried to figure out the coding solution. In debug I discovered setting the ToolsFile caused all the tool lists and classes to get set allowing me to set properties the EditorTool classes.  

I did get the styles URL method to work but only without using the tools.xml, it had to have all the toolbars defined locally in the RadEditor which is a no go with 7 editors in my code.

0
Misho
Telerik team
answered on 02 May 2016, 07:41 AM
Hi,

I am glad you managed to implement the desired scenario.
Please don't hesitate to let us know in case we can be of further assistance in the future.


Regards,
Misho
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Editor
Asked by
George
Top achievements
Rank 2
Answers by
George
Top achievements
Rank 2
Misho
Telerik team
Share this question
or