/// <summary> /// Save layout code. /// </summary> protected bool SaveData() { // Remove "." due to virtual path provider replacement txtCodeName.Text = txtCodeName.Text.Replace(".", ""); txtDisplayName.Text = txtDisplayName.Text.Trim(); txtCodeName.Text = txtCodeName.Text.Trim(); string errorMessage = new Validator() .NotEmpty(txtCodeName.Text, rfvCodeName.ErrorMessage) .NotEmpty(txtDisplayName.Text, rfvDisplayName.ErrorMessage) .IsCodeName(txtCodeName.Text, GetString("general.invalidcodename")).Result; int webPartId = ValidationHelper.GetInteger(Request.QueryString["webpartId"], 0); WebPartInfo webPartInfo = WebPartInfoProvider.GetWebPartInfo(webPartId); if (webPartInfo == null) { errorMessage = GetString("WebPartEditLayoutEdit.InvalidWebPartID"); } if (errorMessage != String.Empty) { lblError.Text = errorMessage; lblError.Visible = true; return(false); } // Get layout info WebPartLayoutInfo webPartLayoutInfo = WebPartLayoutInfoProvider.GetWebPartLayoutInfo(layoutId); if (webPartLayoutInfo != null) { // Get layout info using its code name - layout code name must be unique DataSet ds = WebPartLayoutInfoProvider.GetWebPartLayouts("WebPartLayoutCodeName = '" + WebPartLayoutInfoProvider.GetWebPartLayoutFullCodeName(webPartInfo.WebPartName, txtCodeName.Text) + "'", null); // Find anything? if (!DataHelper.DataSourceIsEmpty(ds)) { WebPartLayoutInfo temp = new WebPartLayoutInfo(ds.Tables[0].Rows[0]); // Is it the same layout? if ((ds.Tables[0].Rows.Count > 1) || (temp.WebPartLayoutID != webPartLayoutInfo.WebPartLayoutID)) { lblError.Text = String.Format(GetString("WebPartEditLayoutEdit.CodeNameAlreadyExist"), txtCodeName.Text); lblError.Visible = true; return(false); } } webPartLayoutInfo.WebPartLayoutCodeName = txtCodeName.Text; webPartLayoutInfo.WebPartLayoutDisplayName = txtDisplayName.Text; webPartLayoutInfo.WebPartLayoutDescription = txtDescription.Text; if (!webPartLayoutInfo.Generalized.IsCheckedOut) { webPartLayoutInfo.WebPartLayoutCode = etaCode.Text; webPartLayoutInfo.WebPartLayoutCSS = tbCSS.Text; } WebPartLayoutInfoProvider.SetWebPartLayoutInfo(webPartLayoutInfo); // Reload header if changes were saved if (TabMode) { ScriptHelper.RefreshTabHeader(Page, null); } } return(true); }