protected void btnNewChoice_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                var prop = HccApp.CatalogServices.ProductProperties.Find(ProductPropertyId.Value);

                var maxSortOrder = prop.Choices.Max(c => (int?)c.SortOrder) ?? 0;

                var ppc = new ProductPropertyChoice();
                ppc.ChoiceName  = txtNewChoice.Text.Trim();
                ppc.DisplayName = txtNewChoice.Text.Trim();
                ppc.PropertyId  = ProductPropertyId.Value;
                ppc.SortOrder   = maxSortOrder + 1;
                prop.Choices.Add(ppc);
                if (HccApp.CatalogServices.ProductProperties.Update(prop))
                {
                    rgChoices.Rebind();
                }
                else
                {
                    msg.ShowError("Couldn't add choice!");
                }
                txtNewChoice.Text = string.Empty;

                ProductPropertyChoiceId   = ppc.Id;
                txtChoiceName.Text        = ppc.ChoiceName;
                txtChoiceDisplayName.Text = ppc.DisplayName;

                ShowEditor(true);
            }
        }
 protected void btnDelete_Click(System.Object sender, System.Web.UI.ImageClickEventArgs e)
 {
     if (this.lstDefaultValue.Items.Count > 0)
     {
         ProductProperty prop = new ProductProperty();
         prop = MTApp.CatalogServices.ProductProperties.Find((long)ViewState["ID"]);
         if (prop != null)
         {
             long choiceId           = long.Parse(lstDefaultValue.SelectedValue);
             ProductPropertyChoice c = prop.Choices.Where(y => y.Id == choiceId).FirstOrDefault();
             if (c != null)
             {
                 prop.Choices.Remove(c);
                 MTApp.CatalogServices.ProductProperties.Update(prop);
                 localProperty = prop;
             }
             PopulateMultipleChoice(prop);
         }
     }
 }
        protected void btnNewChoice_Click(System.Object sender, System.Web.UI.ImageClickEventArgs e)
        {
            msg.ClearMessage();

            ProductProperty prop = new ProductProperty();

            prop = MTApp.CatalogServices.ProductProperties.Find((long)ViewState["ID"]);
            if (prop != null)
            {
                ProductPropertyChoice ppc = new ProductPropertyChoice();
                ppc.ChoiceName = this.NewChoiceField.Text.Trim();
                ppc.PropertyId = (long)ViewState["ID"];
                prop.Choices.Add(ppc);
                if (MTApp.CatalogServices.ProductProperties.Update(prop))
                {
                    PopulateMultipleChoice(prop);
                }
                else
                {
                    msg.ShowError("Couldn't add choice!");
                }
                this.NewChoiceField.Text = string.Empty;
            }
        }