Files
Umbraco-CMS/components/editorControls/label/noEdit.cs
Shandem f6d0d043b5 DO NOT DOWNLOAD. DOWNLOAT LATEST STABLE FROM RELEASE TAB
Created 4.1.0 branch

[TFS Changeset #55082]
2009-06-19 07:39:16 +00:00

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();}
//}
}
}