Configuring CKEditor in an ASP NET control

778 Views Asked by At

I'd appreciate help in understanding how to configure ckeditor in its asp.net control variant.

(I have to use ckeditor inside a data object and using the plain js version which might be easier wont do because the asp.net databinding does not work within an html textarea.)

The aspnet control functions correctly, it updates the db when the dataobjet is refreshed, and I can adjust the number of buttons and arrangement of its toolbars in .net at the databinding event of the enclosing dataobject. But I cannot figure out how to configure the contents of the dropdowns.

I want to restrict the Format list to Normal, Heading 1 and Heading 2. Nothing I do within /ckeditor/config.js makes any difference, eg

config.format_tags = 'p;h1;h2;h3';

The application seems to ignore it completely.

If I try to do this in code behind (I am in VB) together with my other functioning lines within the enclosing object's databinding event as

myCK.config.format_tags = New String() {"p", "h1", "h2", "h3"}

this does not work for syntactical reasons that I don't understand, even though the example from the asp.net config page in the support doc

myCK.config.smiley_descriptions = New String() {"smiley", "sad"}

works fine.

Similarly I have tried making changes to /ckeditor/CKEditor.NET/CKEditorConfig.cs e.g.

GlobalConfigObj.format_tags = "p;h1;h2;h3";,

but this has no effect. The Format dropdown always shows everything from p to pre.

I also cannot add a plugin. Adding this to the config.js file does not enable the plugin (its folder is correctly copied to the plugins folder)

config.extraPlugins = 'autogrow';

again I am not sure if I should be working to get this going within /ckeditor/config.js or in /ckeditor/config.js

Any help would be appreciated.

1

There are 1 best solutions below

0
On

This may not help, but (in c#) with CKEditor (3.6.6) in Page_Load, the line

        myCK.config.format_tags = "p;h1;h2;h3";

does exactly as you are after