Ejemplo n.º 1
0
        protected void grdAvailableParts_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            if (sender == null)
            {
                return;
            }
            if (e == null)
            {
                return;
            }

            GridView grid = (GridView)sender;

            CheckBox     chkAvailableForMyPage             = (CheckBox)grid.Rows[e.RowIndex].Cells[1].FindControl("chkAvailableForMyPage");
            CheckBox     chkAllowMultipleInstancesOnMyPage = (CheckBox)grid.Rows[e.RowIndex].Cells[1].FindControl("chkAllowMultipleInstancesOnMyPage");
            CheckBox     chkAvailableForContentSystem      = (CheckBox)grid.Rows[e.RowIndex].Cells[1].FindControl("chkAvailableForContentSystem");
            DropDownList ddIcons = (DropDownList)grid.Rows[e.RowIndex].Cells[1].FindControl("ddIcons");

            WebPartContent webPartContent = new WebPartContent();

            webPartContent.AllowMultipleInstancesOnMyPage = chkAllowMultipleInstancesOnMyPage.Checked;
            webPartContent.AssemblyName = this.CurrentAssembly;
            webPartContent.AvailableForContentSystem = chkAvailableForContentSystem.Checked;
            webPartContent.AvailableForMyPage        = chkAvailableForMyPage.Checked;
            webPartContent.ClassName   = this.CurrentClass;
            webPartContent.Description = this.CurrentDescription;
            webPartContent.ImageUrl    = ddIcons.SelectedValue;
            webPartContent.SiteId      = siteSettings.SiteId;
            webPartContent.SiteGuid    = siteSettings.SiteGuid;
            webPartContent.Title       = this.CurrentTitle;
            webPartContent.Save();


            WebUtils.SetupRedirect(this, Request.RawUrl);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Click event of the btnUpdate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (this.webPartID != Guid.Empty)
            {
                WebPartContent webPartContent = new WebPartContent(webPartID);
                if (webPartContent.SiteId == siteSettings.SiteId)
                {
                    webPartContent.AvailableForMyPage             = chkAvailableForMyPage.Checked;
                    webPartContent.AllowMultipleInstancesOnMyPage = chkAllowMultipleInstancesOnMyPage.Checked;
                    webPartContent.AvailableForContentSystem      = chkAvailableForContentSystem.Checked;
                    webPartContent.ImageUrl = ddIcons.SelectedValue;
                    webPartContent.Save();
                }
            }

            if (hdnReturnUrl.Value.Length > 0)
            {
                WebUtils.SetupRedirect(this, hdnReturnUrl.Value);
                return;
            }

            WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
        }