public Control MakeControl() { Control input = null; if (this.Type == "Text") { input = new Edit(); input.ID = Control.GetUniqueID("input"); } else if (this.Type == "Dropdown") { Combobox c = new Combobox(); foreach (var value in this.PossibleValues()) { ListItem li = new ListItem(); li.Header = value.Name; li.Value = value.Value; c.Controls.Add(li); } input = c; input.ID = Control.GetUniqueID("input"); } else if (this.Type == "Item Selector") { ASR.Controls.ItemSelector iSelect = new ASR.Controls.ItemSelector(); input = iSelect; input.ID = Control.GetUniqueID("input"); iSelect.Click = string.Concat("itemselector", ":", input.ID); if (this.Parameters["root"] != null) { iSelect.Root = this.Parameters["root"]; } if (this.Parameters["folder"] != null) { iSelect.Folder = this.Parameters["folder"]; } if (this.Parameters["displayresult"] != null) { iSelect.DisplayValueType = (ASR.Controls.ItemInfo)Enum.Parse(typeof(ASR.Controls.ItemInfo), this.Parameters["displayresult"].ToString()); } if (this.Parameters["valueresult"] != null) { iSelect.ValueType = (ASR.Controls.ItemInfo)Enum.Parse(typeof(ASR.Controls.ItemInfo), this.Parameters["valueresult"].ToString()); } if (this.Parameters["filter"] != null) { iSelect.Filter = this.Parameters["filter"]; } } else if (this.Type == "User Selector") { ASR.Controls.UserSelector uSelect = new ASR.Controls.UserSelector(); input = uSelect; input.ID = Control.GetUniqueID("input"); uSelect.Click = string.Concat("itemselector", ":", input.ID); if (this.Parameters["filter"] != null) { uSelect.Filter = this.Parameters["filter"]; } } else if (this.Type == "Date picker") { var dtPicker = new ASR.Controls.DateTimePicker(); dtPicker.Style.Add("float", "left"); dtPicker.ID = Sitecore.Web.UI.HtmlControls.Control.GetUniqueID("input"); dtPicker.Click = "datepicker" + ":" + dtPicker.ID; if (this.Parameters["Format"] != null) { dtPicker.Format = this.Parameters["Format"]; } input = dtPicker; } //input.ID = Control.GetUniqueID("input"); input.Value = this.Value; return(input); }
public Control MakeControl() { Control input = null; if (this.Type == "Text") { input = new Edit(); input.ID = Control.GetUniqueID("input"); } else if (this.Type == "Dropdown") { Combobox c = new Combobox(); foreach (var value in this.PossibleValues()) { ListItem li = new ListItem(); li.Header = value.Name; li.Value = value.Value; c.Controls.Add(li); } input = c; input.ID = Control.GetUniqueID("input"); } else if (this.Type == "Item Selector") { ASR.Controls.ItemSelector iSelect = new ASR.Controls.ItemSelector(); input = iSelect; input.ID = Control.GetUniqueID("input"); iSelect.Click = string.Concat("itemselector", ":", input.ID); if (this.Parameters["root"] != null) iSelect.Root = this.Parameters["root"]; if (this.Parameters["folder"] != null) iSelect.Folder = this.Parameters["folder"]; if (this.Parameters["displayresult"] != null) iSelect.DisplayValueType = (ASR.Controls.ItemInfo)Enum.Parse(typeof(ASR.Controls.ItemInfo), this.Parameters["displayresult"].ToString()); if (this.Parameters["valueresult"] != null) iSelect.ValueType = (ASR.Controls.ItemInfo)Enum.Parse(typeof(ASR.Controls.ItemInfo), this.Parameters["valueresult"].ToString()); if (this.Parameters["filter"] != null) iSelect.Filter = this.Parameters["filter"]; } else if (this.Type == "User Selector") { ASR.Controls.UserSelector uSelect = new ASR.Controls.UserSelector(); input = uSelect; input.ID = Control.GetUniqueID("input"); uSelect.Click = string.Concat("itemselector", ":", input.ID); if (this.Parameters["filter"] != null) uSelect.Filter = this.Parameters["filter"]; } else if (this.Type == "Date picker") { var dtPicker = new ASR.Controls.DateTimePicker(); dtPicker.Style.Add("float", "left"); dtPicker.ID = Sitecore.Web.UI.HtmlControls.Control.GetUniqueID("input"); dtPicker.Click = "datepicker" + ":" + dtPicker.ID; if (this.Parameters["Format"] != null) dtPicker.Format = this.Parameters["Format"]; input = dtPicker; } //input.ID = Control.GetUniqueID("input"); input.Value = this.Value; return input; }