Ejemplo n.º 1
0
        protected void btnAction_Command(object sender, System.Web.UI.WebControls.CommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "AddNew":
                pnlAddCategory.Visible = true;

                BindVersion();
                break;

            case "Cancel":
                pnlAddCategory.Visible = false;
                txtCategory.Text       = "";

                break;

            case "Add":
                if (Page.IsValid)
                {
                    CSFactory.SaveVersionCategory(0, CommonHelper.fixquotesAccents(txtCategory.Text));
                }


                pnlAddCategory.Visible = false;
                txtCategory.Text       = "";

                BindVersion();
                break;

            case "Back":
                Response.Redirect("VersionList.aspx");
                break;
            }
        }
Ejemplo n.º 2
0
        protected void dlVersionList_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            int categoryId = (int)dlVersionList.DataKeys[e.Item.ItemIndex];

            switch (e.CommandName)
            {
            case "Delete":
                CSFactory.RemoveVersionCategory(categoryId);
                BindVersion();
                break;

            case "Edit":
                dlVersionList.EditItemIndex = e.Item.ItemIndex;
                BindVersion();
                break;

            case "Cancel":
                dlVersionList.EditItemIndex = -1;
                BindVersion();
                break;

            case "Update":
                TextBox tbedit = (TextBox)e.Item.FindControl("txtEditCategory");

                CSFactory.SaveVersionCategory(categoryId, CommonHelper.fixquotesAccents(tbedit.Text.Trim()));
                dlVersionList.EditItemIndex = -1;
                BindVersion();
                break;
            }
        }