2

I'm customizing the buttons I'll show in the Ajax Html Editor and would like to see a sample of how to add font-size options inside the dropdownlist.

public class HtmlEditor : Editor
{
{
protected override void FillTopToolbar()
TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.FontSize());
}
}

It shows the fontsize option but with a empty dropdownlist.

How to show it with customized fontsize option? For sample, I want to show inside the fontsize dropdownlist just the options from 8 to 16.

Thank you

Josi

2 Answers 2

2

Try something like this:

AjaxControlToolkit.HTMLEditor.ToolbarButton.FontSize MyFontSize = new AjaxControlToolkit.HTMLEditor.ToolbarButton.FontSize();
TopToolbar.Buttons.Add(MyFontSize);
AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption fontsizeOptions = new AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption();

fontsizeOptions.Value = "8pt";
fontsizeOptions.Text = "18";
MyFontSize.Options.Add(fontsizeOptions);


fontsizeOptions = new AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption();
fontsizeOptions.Value = "16pt";
fontsizeOptions.Text = "16";
MyFontSize.Options.Add(fontsizeOptions);
Sign up to request clarification or add additional context in comments.

Comments

0
protected override void FillTopToolbar()
{
        //TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.FontSize());
        AjaxControlToolkit.HTMLEditor.ToolbarButton.FontSize MyFontSize = new AjaxControlToolkit.HTMLEditor.ToolbarButton.FontSize();
        TopToolbar.Buttons.Add(MyFontSize);
        AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption fontsizeOptions = new AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption();

        fontsizeOptions.Value = "10.5px";
        fontsizeOptions.Text = "1";
        MyFontSize.Options.Add(fontsizeOptions);

        fontsizeOptions = new AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption();
        fontsizeOptions.Value = "13.0px";
        fontsizeOptions.Text = "2";
        MyFontSize.Options.Add(fontsizeOptions);

        fontsizeOptions = new AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption();
        fontsizeOptions.Value = "15.5px";
        fontsizeOptions.Text = "3";
        MyFontSize.Options.Add(fontsizeOptions);

        fontsizeOptions = new AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption();
        fontsizeOptions.Value = "17.5px";
        fontsizeOptions.Text = "4";
        MyFontSize.Options.Add(fontsizeOptions);

        fontsizeOptions = new AjaxControlToolkit.HTMLEditor.ToolbarButton.SelectOption();
        fontsizeOptions.Value = "23.5px";
        fontsizeOptions.Text = "5";
        MyFontSize.Options.Add(fontsizeOptions);

    }
}

1 Comment

Please provide some more context to the answer and shorten down the code. Just pasting a bunch of code lines is not very clear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.