public void SetValue(Control editor, string value) { Assert.ArgumentNotNull(editor, "editor"); Assert.ArgumentNotNull(value, "value"); if (!(editor is IStreamedContentField)) { IContentField field = editor as IContentField; if (field != null) { field.SetValue(value); } else { Sitecore.Reflection.ReflectionUtil.SetProperty(editor, "Value", value); } } }
public virtual string GetValue(System.Web.UI.Control editor) { if (editor as Cell != null) { editor = editor.Controls.Filter <System.Web.UI.Control>().FirstOrDefault() ?? editor; } IContentField contentField = editor as IContentField; if (contentField != null) { return(contentField.GetValue()); } object value = ReflectionUtil.GetProperty(editor, "Value"); return(value == null ? null : value.ToString()); }
public virtual void SetValue(System.Web.UI.Control editor, string value) { if (editor as Cell != null) { editor = editor.Controls.Filter <System.Web.UI.Control>().FirstOrDefault() ?? editor; } value = value ?? string.Empty; if (editor is IStreamedContentField) { return; } IContentField contentField = editor as IContentField; if (contentField != null) { contentField.SetValue(value); return; } ReflectionUtil.SetProperty(editor, "Value", value); }