47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using System;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace umbraco.editorControls
|
|
{
|
|
public class noEdit : System.Web.UI.WebControls.Label, interfaces.IDataEditor
|
|
{
|
|
private interfaces.IData _data;
|
|
private bool labelRefreshed = false;
|
|
|
|
public noEdit(interfaces.IData Data) {
|
|
_data = Data;
|
|
}
|
|
public virtual bool TreatAsRichTextEditor
|
|
{
|
|
get {return false;}
|
|
}
|
|
public bool ShowLabel {get {return true;}}
|
|
|
|
public void Save()
|
|
{
|
|
// Uncommented this as a label should *never* update itself via ui
|
|
// _data.Value = this.Text;
|
|
}
|
|
|
|
public void RefreshLabel(string content)
|
|
{
|
|
Text = content;
|
|
labelRefreshed = true;
|
|
}
|
|
|
|
public Control Editor {get {return this;}}
|
|
|
|
protected override void OnInit(EventArgs e)
|
|
{
|
|
if (!labelRefreshed && (_data != null && _data.Value != null))
|
|
Text = _data.Value.ToString();
|
|
|
|
base.OnInit(e);
|
|
}
|
|
|
|
//public override string Text {
|
|
// get {return _data.Value.ToString();}
|
|
//}
|
|
}
|
|
} |