protected void dlVersionList_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            int versionId = (int)dlVersionList.DataKeys[e.Item.ItemIndex];

            switch (e.CommandName)
            {
            case "Delete":
                CSFactory.RemoveVersion(versionId);
                BindVersion();
                break;

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

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

            case "Update":
                TextBox      txtEditTitle     = (TextBox)e.Item.FindControl("txtEditTitle");
                TextBox      txtEditShortName = (TextBox)e.Item.FindControl("txtEditShortName");
                CheckBox     cbVisible        = (CheckBox)e.Item.FindControl("cbVisible");
                DropDownList ddlCategory      = (DropDownList)e.Item.FindControl("ddlEditCategory");
                CSFactory.UpdateVersion(versionId, CommonHelper.fixquotesAccents(txtEditTitle.Text.Trim()), CommonHelper.fixquotesAccents(txtEditShortName.Text), cbVisible.Checked, Convert.ToInt32(ddlCategory.SelectedValue));
                dlVersionList.EditItemIndex = -1;
                BindVersion();
                break;
            }
        }
Beispiel #2
0
        protected void dlVersionList_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            int versionId = (int)dlVersionList.DataKeys[e.Item.ItemIndex];

            switch (e.CommandName)
            {
            case "Delete":
                CSFactory.RemoveVersion(versionId);
                BindVersion();
                break;

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

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

            case "Update":
                TextBox          txtEditTitle     = (TextBox)e.Item.FindControl("txtEditTitle");
                TextBox          txtEditShortName = (TextBox)e.Item.FindControl("txtEditShortName");
                CheckBox         cbVisible        = (CheckBox)e.Item.FindControl("cbVisible");
                CheckBox         cbDynamic        = (CheckBox)e.Item.FindControl("cbDynamic");
                DropDownList     ddlCategory      = (DropDownList)e.Item.FindControl("ddlEditCategory");
                DropDownList     ddlModel         = (DropDownList)e.Item.FindControl("ddlModelEdit");
                GroupRadioButton rbDesktop        = (GroupRadioButton)e.Item.FindControl("rbDesktop");
                GroupRadioButton rbTablet         = (GroupRadioButton)e.Item.FindControl("rbTablet");
                GroupRadioButton rbMobile         = (GroupRadioButton)e.Item.FindControl("rbMobile");

                CSFactory.UpdateVersion(versionId, CommonHelper.fixquotesAccents(txtEditTitle.Text.Trim()),
                                        CommonHelper.fixquotesAccents(txtEditShortName.Text), cbVisible.Checked, Convert.ToInt32(ddlCategory.SelectedValue)
                                        , cbDynamic.Checked, Convert.ToInt32(ddlModel.SelectedValue), rbDesktop.Checked, rbTablet.Checked, rbMobile.Checked);
                VersionManager.LoadVersions();
                dlVersionList.EditItemIndex = -1;
                BindVersion();
                break;
            }
        }