user1509
user1509

Reputation: 1161

Disable AJAX editor in C#

I have a condition based upon which I require that the AJAX HTML Editor gets disable. This code is not working:

edNote.Enabled=false; //edNote is AJAX editor.

Please suggest any other means to do this.

Upvotes: 2

Views: 1594

Answers (2)

user1509
user1509

Reputation: 1161

I found that a custom editor can also be made where we can display editor according to our needs. The code and link are given below:

Code:

namespace TestControls
{
public class CustomEditor : Editor
{
    protected override void FillTopToolbar()
    {
        TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.Bold());
        TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.Italic());
    }
    protected override void FillBottomToolbar()
    {
        TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.DesignMode());
        TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.PreviewMode());
    }
}
}

Link: Custom Editor

Upvotes: 0

Steve B
Steve B

Reputation: 37660

Instead of disabling it, output a <asp:literal> in place of the whole editor.

<HTMLEditor:Editor runat="server" id="edNote" />
<asp:Literal runat="server" id="lit" />

in C#

edNote.Visible = !condition;
lit.Visible = condition;

Upvotes: 1

Related Questions