Due to the rapid development of internal systems in the company.
Use WEB Form to quickly develop programs. Use Microsoft's own AJAX library and Toolkit
The text editor HTMLEditor in the library is used in the first time. Although the editor is small, it is basically
It meets my needs, and there are a lot of Button menus that I don't need, so I inherited the control and overwritten it.
A depressing problem occurs. Due to the editing permission problem, some content cannot be edited Based on the role.
Using Enable = false never disables content editing.
So I found that the control ActiveMode = ActiveModeType. Design (that is, the preview mode) cannot be edited.
The following is my implementation:
Step 1:
1 protected override void FillBottomToolbar()
2 {
3 if (base.Enabled)
4 {
5 BottomToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.DesignMode());
6 BottomToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.HtmlMode());
7 }
8 //BottomToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.PreviewMode());
9 }
Step 2:
1 /// <summary>
2 // rewrite Enable
3 /// </summary>
4 public override bool Enabled
5 {
6 get
7 {
8 return base. Enabled;
9}
10 set
11 {
12 base. Enabled = value;
13
14 ActiveMode = value? ActiveModeType. Design: ActiveModeType. Preview;
15
16 if (! Value)
17 {
18 BottomToolbar. Controls. Clear ();
19}
20 else
21 {
22 FillBottomToolbar ();
23}
24
25}
26}
Well, it's done. Now setting Enable = false is the result I need!
I haven't written anything for a long time. Don't knock on me.