0

I need to create an obout:Editor in a switchable plain-mode and a fuller RTF mode. I have declared the editor as follows in my .aspx:

<obout:Editor ID="edtComment" runat="server" PathPrefix="../styles/" Submit="false" modeSwitch="false" Appearance="custom" AutoFocus="true" ShowQuickFormat="false" />

...and I have put the following in my Page_Init routine:

protected void Page_Init(object sender, EventArgs e)
{
    if (cConfig.FEATURE_ENABLERICHTEXTCOMMENTS)
    {
        // Add buttons
        OboutInc.Editor.Method btnUndo = new OboutInc.Editor.Method(); btnUndo.Name = OboutInc.Editor.Method.Names.Undo; edtComment.Buttons.Add(btnUndo);
        OboutInc.Editor.Method btnRedo = new OboutInc.Editor.Method(); btnRedo.Name = OboutInc.Editor.Method.Names.Redo; edtComment.Buttons.Add(btnRedo);
        OboutInc.Editor.Method btnToLowerCase = new OboutInc.Editor.Method(); btnToLowerCase.Name = OboutInc.Editor.Method.Names.ToLowerCase; edtComment.Buttons.Add(btnToLowerCase);
        OboutInc.Editor.Method btnToUpperCase = new OboutInc.Editor.Method(); btnToUpperCase.Name = OboutInc.Editor.Method.Names.ToUpperCase; edtComment.Buttons.Add(btnToUpperCase);
        OboutInc.Editor.Toggle btnBold = new OboutInc.Editor.Toggle(); btnBold.Name = OboutInc.Editor.Toggle.Names.Bold; edtComment.Buttons.Add(btnBold);
        OboutInc.Editor.Toggle btnItalic = new OboutInc.Editor.Toggle(); btnItalic.Name = OboutInc.Editor.Toggle.Names.Italic; edtComment.Buttons.Add(btnItalic);
        OboutInc.Editor.Toggle btnUnderline = new OboutInc.Editor.Toggle(); btnUnderline.Name = OboutInc.Editor.Toggle.Names.Underline; edtComment.Buttons.Add(btnUnderline);
        OboutInc.Editor.Toggle btnStrikeThrough = new OboutInc.Editor.Toggle(); btnStrikeThrough.Name = OboutInc.Editor.Toggle.Names.StrikeThrough; edtComment.Buttons.Add(btnStrikeThrough);
        OboutInc.Editor.Method btnCut = new OboutInc.Editor.Method(); btnCut.Name = OboutInc.Editor.Method.Names.Cut; edtComment.Buttons.Add(btnCut);
        OboutInc.Editor.Method btnCopy = new OboutInc.Editor.Method(); btnCopy.Name = OboutInc.Editor.Method.Names.Copy; edtComment.Buttons.Add(btnCopy);
        OboutInc.Editor.Method btnPaste = new OboutInc.Editor.Method(); btnPaste.Name = OboutInc.Editor.Method.Names.Paste; edtComment.Buttons.Add(btnPaste);
        OboutInc.Editor.Method btnPasteWord = new OboutInc.Editor.Method(); btnPasteWord.Name = OboutInc.Editor.Method.Names.PasteWord; edtComment.Buttons.Add(btnPasteWord);
        OboutInc.Editor.Method btnClearStyles = new OboutInc.Editor.Method(); btnClearStyles.Name = OboutInc.Editor.Method.Names.ClearStyles; edtComment.Buttons.Add(btnClearStyles);
        OboutInc.Editor.Method btnSpellCheck = new OboutInc.Editor.Method(); btnSpellCheck.Name = OboutInc.Editor.Method.Names.SpellCheck; edtComment.Buttons.Add(btnSpellCheck);

        // Add Dictionary
        OboutInc.Editor.Dictionary dic;

        dic = new OboutInc.Editor.Dictionary();
        dic.FileName = "en-CA.dic";
        dic.DisplayName = "Canada English";
        edtComment.Dictionaries.Add(dic);

        dic = new OboutInc.Editor.Dictionary();
        dic.FileName = "en-US.dic";
        dic.DisplayName = "English(US)";
        edtComment.Dictionaries.Add(dic);

        // Add QuickFormatting
        edtComment.ShowQuickFormat = true;
        edtComment.QuickFormatFile = "AEMS_RTF_Quickformat.css";
    }
}

However, when I enable my RichTextComments feature, either my code isn't firing, or the editor isn't responding to the changes. Is Page_Init the right place for this? Is there a better way to control these options?

Daniel Bragg
  • 1,773
  • 1
  • 12
  • 25
  • `cConfig.FEATURE_ENABLERICHTEXTCOMMENTS` where are you declaring / assigning or accessing this from show all relevant code.. have you tried putting it in the `Page_Load` and wrapping the `if(!IsPostBack){}` around it..? – MethodMan Oct 23 '14 at 20:47
  • Yes, the code needs to be in `Page_Load`, not in `Page_Init`. It seems that the control needs to be fully instantiated before receiving these updates. – Daniel Bragg Oct 23 '14 at 20:57
  • well change it there and report back if the issue has not been resolved..thanks – MethodMan Oct 23 '14 at 20:58
  • Putting the above code into `Page_Load` corrects the issue. – Daniel Bragg Oct 23 '14 at 21:01
  • glad I could quickly answer that for you in the form of a Comment.. cool – MethodMan Oct 23 '14 at 21:03

0 Answers0