views:

48

answers:

1
public class CustomEditor : Editor
{
    protected override void Render(HtmlTextWriter writer)
    {
        Toolbar topToolbar = this.TopToolbar;
        Collection<AjaxControlToolkit.HTMLEditor.ToolbarButton.CommonButton> buttons = topToolbar.Buttons;

        foreach (AjaxControlToolkit.HTMLEditor.ToolbarButton.CommonButton button in buttons)
        {
            switch (button.GetType().Name)
            {
                case "Undo":
                    button.ToolTip = "Отменить ввод";
                    break;
                case "Redo":
                    button.ToolTip = "Повторить ввод";
                    break;
                // many others buttons

                case "FixedForeColor":
                    button.ToolTip = "Цвет текста";
                    break;
                case "FixedBackColor":
                    button.ToolTip = "Цвет выделения текста";
                    break;
            }
        }
        base.Render(writer);
    }
}

Almoust everything works fine. The problem is with buttons "FixedForeColor" and "FixedBackColor". Their tooltips are not changed (and still in English). Is there any solution?

+1  A: 

Oh yes. I've found the solution. It's a little bit crazy (because i'm new to asp.net and i don't know how to find child controls properly).

Solution: the control with a tooltip to display was much deeper.

case "FixedForeColor":
    ((AjaxControlToolkit.HTMLEditor.ToolbarButton.MethodButton)button.Controls[0].Controls[0].Controls[0].Controls[0]).ToolTip = "Цвет текста";
    break;
case "FixedBackColor":
    ((AjaxControlToolkit.HTMLEditor.ToolbarButton.MethodButton)button.Controls[0].Controls[0].Controls[0].Controls[0]).ToolTip = "Цвет выделения текста";
    break;

If someone knows how to make it easier, please comment.

Raigomaru