Re: Build toolbars programatically without using config files

  •  03-03-2010, 12:24 PM

    Re: Build toolbars programatically without using config files

    MMCD:
    Going back to my original question regarding configuration files. Is there any way to use and configure this control 100% on the server without relying on any config files at all. By this, I mean we do not want to rely on any file that reside in the /CuteSoft_Client/CuteEditor/Configuration/ folder. We understand that resources such as images and dialog scripts need to be present in certain folders, but we must be able to remove the configuration folder and do it 100% on the server.
     
    Here is a simple example.
     
    Add the following code into the <appSettings> element of your application web.config file:
     
    <add key="CuteEditorProviderType" value="ProjectName.MyProvider,ProjectName" />
     
    C# code:
     
    1. public class MyProvider : CuteEditor.Impl.EditorProvider   
    2.     {   
    3.         public MyProvider(HttpContext context):base(context)   
    4.         {   
    5.         }   
    6.         public override CuteEditor.Impl.ConfigItem[] GetToolbarItems(CuteEditor.Editor editor, string type)   
    7.         {   
    8.             if(type=="toolbars")   
    9.             {   
    10.                 ArrayList items=new ArrayList();   
    11.                 CuteEditor.Impl.ConfigItem item;   
    12.   
    13.                 item=new CuteEditor.Impl.ConfigItem();   
    14.                 item.Type="g_start";   
    15.                 items.Add(item);   
    16.   
    17.                 item=new CuteEditor.Impl.ConfigItem();   
    18.                 item.Command="bold";   
    19.                 item.ImageName="bold";   
    20.                 items.Add(item);   
    21.   
    22.                 item=new CuteEditor.Impl.ConfigItem();   
    23.                 item.Type="g_end";   
    24.                 items.Add(item);   
    25.   
    26.                 return (CuteEditor.Impl.ConfigItem[])items.ToArray(typeof(CuteEditor.Impl.ConfigItem));   
    27.             }   
    28.             return base.GetToolbarItems (editor, type);   
    29.         }   
    30.   
    31.     }  

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread