using System; using System.Web.UI.WebControls; using CMS.CMSHelper; using CMS.FormControls; using CMS.GlobalHelper; using CMS.SettingsProvider; using CMS.UIControls; using CMS.SiteProvider; public partial class CMSModules_CustomTables_FormControls_CustomTableItemSelector : FormEngineUserControl { #region "Public properties" /// /// Custom table class name /// public string CustomTable { get { return ValidationHelper.GetString(GetValue("CustomTable"), null); } set { SetValue("CustomTable", value); uniSelector.ObjectType = CustomTableItemProvider.GetObjectType(value); } } /// /// Display name format (for example 'Item {%ItemGUID%}') /// public string DisplayNameFormat { get { return ValidationHelper.GetString(GetValue("DisplayNameFormat"), null); } set { SetValue("DisplayNameFormat", value); uniSelector.DisplayNameFormat = value; } } /// /// Return column name /// public string ReturnColumnName { get { return ValidationHelper.GetString(GetValue("ReturnColumnName"), null); } set { SetValue("ReturnColumnName", value); uniSelector.ReturnColumnName = value; } } /// /// Gets or sets the enabled state of the control. /// public override bool Enabled { get { return base.Enabled; } set { base.Enabled = value; if (uniSelector != null) { uniSelector.Enabled = value; } } } /// /// Returns ClientID of the textbox with class names. /// public override string ValueElementID { get { return uniSelector.TextBoxSelect.ClientID; } } /// /// Gets or sets the field value. /// public override object Value { get { return uniSelector.Value; } set { if (uniSelector == null) { pnlUpdate.LoadContainer(); } uniSelector.Value = value; } } /// /// Gets inner uniselector. /// public UniSelector UniSelector { get { return uniSelector; } } #endregion #region "Page events" protected void Page_Load(object sender, EventArgs e) { if (StopProcessing) { uniSelector.StopProcessing = true; } else { ReloadData(); } } #endregion protected override void EnsureChildControls() { if (uniSelector == null) { pnlUpdate.LoadContainer(); } base.EnsureChildControls(); } /// /// Reloads the data in the selector. /// public void ReloadData() { uniSelector.IsLiveSite = IsLiveSite; uniSelector.DisplayNameFormat = DisplayNameFormat; uniSelector.ReturnColumnName = ReturnColumnName; uniSelector.ObjectType = CustomTableItemProvider.GetObjectType(CustomTable); uniSelector.IconPath = GetImageUrl("CMSModules/CMS_CustomTables/module.png"); uniSelector.Reload(false); } }