protected void btnNew_Click(object sender, System.Web.UI.ImageClickEventArgs e) { if ((OptionId != string.Empty)) { Option opt = MyPage.MTApp.CatalogServices.ProductOptions.Find(OptionId); if ((opt != null)) { opt.AddItem(this.NewNameField.Text.Trim()); MyPage.MTApp.CatalogServices.ProductOptions.Update(opt); this.NewNameField.Text = string.Empty; this.NewNameField.Focus(); } } RenderItems(); }
/// <summary> /// Sets the product choice item. /// </summary> /// <param name="choice">The option.</param> public void AddProductChoiceItem(ref Option choice) { try { var element = _xmldoc.Elements("ProductChoices").Elements("EditChoice").FirstOrDefault(); if (element == null) { return; } foreach (var item in Convert.ToString(element.Element("AddOptionItem").Value).Split(',')) { choice.AddItem(item); } } catch (Exception) { return; } }