コード例 #1
0
        protected void dgOptionsForAnAttribute_ItemCommand(Object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            viewMode = "EditAnAttribute";
            setViewMode();

            string optionValue;
            int    attributeId;

            attributeId = int.Parse(txtEditAnAttributeId.Text);
            MetadataNewDa MNDa = new MetadataNewDa();

            switch (e.CommandName)
            {
            case "Delete":

                optionValue = ((Literal)e.Item.Cells[0].Controls[1]).Text;
                MNDa.DeleteAttributeValueOption(attributeId, optionValue);
                loadAttributeValueOptionsForAnAttribute(attributeId);
                break;

            case "Add":
                optionValue = ((TextBox)e.Item.FindControl("txtNewOption")).Text;
                MNDa.AddAttributeValueOption(attributeId, optionValue);
                loadAttributeValueOptionsForAnAttribute(attributeId);
                break;
            }
        }