ActiveTopics Sat, 30 Apr 2016 11:10:58 +00:00 umbraco Latests topics from the forum on en 'Umbraco' threw an exception of type 'System.NullReferenceException' Hello all... we have a very strange issue here that we need community assistance on:

After upgrading from version 7.1.2 to 7.4.3 using nuget package manager and successfully loading the homepage and other views on the website, we started experiencing missing images on our custom 'product' view page.

We traced the issue back to a RenderMvcController named ProductController.cs and have attached a screenshot of the specific error as shown inside of VS. To summarize, it appears Umbraco is somehow undefined and it fails wherever we use Umbraco.Media(). This is the only controller we use this in.

Below is the entire controller but one thing to note is, nothing in this code has changed at all (along with every other model, view, and controller). We are using uCommerce for eCommerce purposes but I am not suspecting this as the cause at this point. Also, I have tried replacing Umbraco.Media() with MediaService calls and MS also throws the Null exception.

Any direction would be GREATLY appreciated!


using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web.Mvc;
using UCommerce.Api;
using UCommerce.EntitiesV2;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Web;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
using UmbracoSite.Helpers;
using UmbracoSite.Models;

namespace UmbracoSite.Controllers
    /// <summary>
    /// The ProductController Class
    /// </summary>
    public class ProductController : RenderMvcController
        private static readonly FolderHelper FolderHelper = new FolderHelper();
        private static readonly List<ProductTarget> ProductTargets = ProductTarget.All().Where(x => !x.CampaignItem.Campaign.Deleted
                                                                                            && x.CampaignItem.Enabled
                                                                                            && !x.CampaignItem.Deleted
                                                                                            && x.CampaignItem.Campaign.Enabled
                                                                                            && x.CampaignItem.Campaign.StartsOn <= DateTime.Now
                                                                                            && x.CampaignItem.Campaign.EndsOn >= DateTime.Now)
        private static readonly List<CategoryTarget> CategoryTargets = CategoryTarget.All().Where(x => !x.CampaignItem.Campaign.Deleted
                                                                                            && x.CampaignItem.Enabled
                                                                                            && !x.CampaignItem.Deleted
                                                                                            && x.CampaignItem.Campaign.Enabled
                                                                                            && x.CampaignItem.Campaign.StartsOn <= DateTime.Now
                                                                                            && x.CampaignItem.Campaign.EndsOn >= DateTime.Now)
        private static readonly PriceGroup PriceGroup = PriceGroup.FirstOrDefault(x => x.Name.Equals("US Dollar"));

        /// <summary>
        /// Override method where the page (any page that has the document type "Product")
        /// is rendered.
        /// </summary>
        /// <param name="model">the current Umbraco model</param>
        /// <returns></returns>
        public override ActionResult Index(RenderModel model)
            return base.Index(model);

        /// <summary>
        /// Returns images for the product (swatch, front and back image)
        /// </summary>
        /// <param name="product">the product model</param>
        /// <param name="uComProduct">the product from ucommerce</param>
        /// <param name="sku">sku of the product</param>
        /// <returns>the product model with image properties assigned</returns>
        private ProductModel GetProductImages(ProductModel product, Product uComProduct, string sku)
                var backImage = uComProduct.GetProperty("backImage").GetValue().ToString();
                var frontImage = uComProduct.GetProperty("frontImage").GetValue().ToString();
                var productThumbnailImages = FolderHelper.GetThumbnails(sku).ToArray();
                var ms = Services.MediaService;

                int backImageNumber;
                if (!string.IsNullOrEmpty(backImage) && int.TryParse(backImage, out backImageNumber))
                    var backImageMediaItem = ms.GetById(backImageNumber);
                    product.BackImageUrl = backImageMediaItem != null ? backImageMediaItem.Path : productThumbnailImages[1];

                int frontImageNumber;
                if (!string.IsNullOrEmpty(frontImage) && int.TryParse(frontImage, out frontImageNumber))
                    var frontImageMediaItem = ms.GetById(frontImageNumber);
                    product.FrontImageUrl = frontImageMediaItem != null ? frontImageMediaItem.Path : productThumbnailImages[0];
            catch (Exception ex)
                LogHelper.Error(MethodBase.GetCurrentMethod().DeclaringType, "ProductController.GetProductImages()", ex);
            return product;

        /// <summary>
        /// Creates a ProductModel and VariantModel data associated to it. The ProductCategoryModel will be the 
        /// "ProductCategory" Document Type in Umbraco. The ProductModel is the "Product" 
        /// Document Type in Umbraco, and the VariantModel is the "Variant" Document Type 
        /// in Umbraco. Variables prefixed with "umb" are Umbraco based, and variants prefixed
        /// with "uCom" are uCommerce based.
        /// </summary>
        /// <param name="umbProduct">the Umbraco product node</param>
        /// <param name="isForPopularProduct"></param>
        /// <param name="count"></param>
        /// <returns>populated product model with relavant variants</returns>
        public ProductModel GetVariantsFromProduct(IPublishedContent umbProduct, bool isForPopularProduct = false, short count = 0)
            var product = new ProductModel();

                // variant name are always the SKU
                var uComProduct = Product.FirstOrDefault(x => x.Sku.Equals(umbProduct.Name));
                if (uComProduct != null && PriceGroup != null)
                    string swatchImage = uComProduct.GetProperty("swatch").GetValue().ToString(),
                           color = uComProduct.GetProperty("color").GetValue().ToString(),
                           sku = uComProduct.GetSku();

                    if (isForPopularProduct && count <= 3)
                        product = GetProductImages(product, uComProduct, sku);
                    else if (!isForPopularProduct)
                        product = GetProductImages(product, uComProduct, sku);
                        product.UmbracoNodeId = umbProduct.Id;
                        product.Fabric = uComProduct.GetProperty("fabric").GetValue().ToString();

                    product.Sku = sku;
                    product.SwatchImageUrl = !string.IsNullOrEmpty(swatchImage) && !swatchImage.Equals("0") ? Umbraco.Media(swatchImage).Url : FolderHelper.GetSwatch(color);
                    product.Color = color;
                    product.Variants = new List<VariantModel>();
                    product.HasDiscount = ProductTargets.Any(x => x.Skus.Contains(uComProduct.Sku));

                    // gets the products variants (these are the variant rows in uCommerce)
                    foreach (var uComVariant in uComProduct.Variants)
                        var variant = new VariantModel()
                            Price = uComVariant.GetPrice(PriceGroup) == null ? 0m : uComVariant.GetPrice(PriceGroup).Value,
                            HasDiscount = ProductTargets.Any(x => x.Skus.Contains(uComVariant.Sku))

                        // this will only get first - other discounts retrived from api call in VariantApiController
                        if (!isForPopularProduct && variant.HasDiscount && !product.Variants.Any(x => x.HasDiscount))
                            var calcPrice = CatalogLibrary.CalculatePrice(uComVariant);

                            if (calcPrice.IsDiscounted)
                                variant.DiscountPrice = calcPrice.YourPrice.Amount.Value;

                        if (!isForPopularProduct)
                            variant.Description = uComVariant.Name;
                            variant.VariantSku = uComVariant.VariantSku;
                            variant.Size = uComVariant.GetProperty("size").GetValue();
                            variant.InventoryOnHand = int.Parse(uComVariant.GetProperty("InventoryOnHand").GetValue().ToString()) - GetOrderLineQuantity(uComVariant.VariantSku);
                            variant.MSRP = decimal.Parse(uComVariant.GetProperty("msrp").GetValue().ToString());

                            var stockNotes = uComVariant.GetProperty("stockNotes").GetValue().ToString();
                            variant.StockNotes = string.IsNullOrEmpty(stockNotes) ? "Out of stock" : stockNotes;


                product.MinVariantPrice = product.Variants.Where(x => x.Price > 0).Min(x => x.Price);

            catch (Exception ex)
                LogHelper.Error(MethodBase.GetCurrentMethod().DeclaringType, "ProductController.GetVariantsFromProduct()", ex);

            return product;

        /// <summary>
        /// Creates a ProductCategoryModel object with relavant ProductModel and 
        /// VariantModel data associated to it. The ProductCategoryModel will be the 
        /// "ProductCategory" Document Type in Umbraco. The ProductModel is the "Product" 
        /// Document Type in Umbraco, and the VariantModel is the "Variant" Document Type 
        /// in Umbraco. Variables prefixed with "umb" are Umbraco based, and variants prefixed
        /// with "uCom" are uCommerce based.
        /// </summary>
        /// <param name="umbProductCategory">the product category in Umbraco</param>
        /// <param name="isForPopularProducts"></param>
        /// <returns>ProductCategoryModel with relavant data about it's children and sub-children</returns>
        public ProductCategoryModel GetProductsFromCategory(IPublishedContent umbProductCategory, bool isForPopularProducts = false)
            var productCategory = new ProductCategoryModel();

                if (!umbProductCategory.HasProperty("productNumber")) return productCategory;

                var isNewProduct = false;
                var isHidden = false;
                var isBestSeller = false;
                var saleOnCategoryPage = false;
                var saleTextOnCategoryPage = String.Empty;
                var hideOriginalPriceOnCategoryPage = false;

                if (umbProductCategory.HasProperty("newProduct"))
                    isNewProduct = (bool)umbProductCategory.GetProperty("newProduct").Value;
                if (umbProductCategory.HasProperty("hideProduct"))
                    isHidden = (bool)umbProductCategory.GetProperty("hideProduct").Value;
                if (umbProductCategory.HasProperty("bestSeller"))
                    isBestSeller = (bool)umbProductCategory.GetProperty("bestSeller").Value;
                if (umbProductCategory.HasProperty("saleOnCategoryPage"))
                    saleOnCategoryPage = (bool)umbProductCategory.GetProperty("saleOnCategoryPage").Value;
                if (umbProductCategory.HasProperty("saleTextOnCategoryPage"))
                    saleTextOnCategoryPage = (string)umbProductCategory.GetProperty("saleTextOnCategoryPage").Value;
                if (umbProductCategory.HasProperty("hideOriginalPriceOnCategoryPage"))
                    hideOriginalPriceOnCategoryPage = (bool)umbProductCategory.GetProperty("hideOriginalPriceOnCategoryPage").Value;

                var uComCategory = Category.FirstOrDefault(x => x.Definition.Name.Equals("Product") &&
                                                            x.CategoryProperties.Any(y => y.DefinitionField.Name.Equals("productNumber")
                                                                    && y.Value.Equals(umbProductCategory.GetProperty("productNumber").Value.ToString())));

                if (uComCategory != null)
                    productCategory = new ProductCategoryModel()
                        UmbracoNodeId = umbProductCategory.Id,
                        Products = new List<ProductModel>(),
                        IsNewProduct = isNewProduct,
                        IsHidden = isHidden,
                        IsBestSeller = isBestSeller,
                        ProductCatName = umbProductCategory.Name,
                        HasDiscount = CategoryTargets.Any(x => x.Name.ToLower().Equals(uComCategory.Name.ToLower())) || saleOnCategoryPage,
                        SaleTextOnCategoryPage = saleTextOnCategoryPage,
                        HideOriginalPriceOnCategoryPage = hideOriginalPriceOnCategoryPage

                    // iterate through Variants (this is product in uCommerce)
                    short count = 0;
                    foreach (var umbProduct in umbProductCategory.Children.Where(x => x.DocumentTypeAlias.Equals("Variant")).OrderBy(x => x.SortOrder).ToList())
                        productCategory.Products.Add(GetVariantsFromProduct(umbProduct, isForPopularProducts, count++));
            catch (Exception ex)
                LogHelper.Error(MethodBase.GetCurrentMethod().DeclaringType, "ProductController.GetProductsFromCategory()", ex);

            return productCategory;

        /// <summary>
        /// Retrives a list of ProductCategories
        /// </summary>
        /// <param name="umbProductCategories">the list of product categories to iterate through (Umbraco)</param>
        /// <param name="isForPopularProducts"></param>
        /// <returns>list of product categories with relavant data</returns>
        public List<ProductCategoryModel> GetProductCategoryData(List<IPublishedContent> umbProductCategories, bool isForPopularProducts)
            var productCategories = new List<ProductCategoryModel>();

            foreach (var umbProductCat in umbProductCategories)
                productCategories.Add(GetProductsFromCategory(umbProductCat, isForPopularProducts));

            return productCategories;

        /// <summary>
        /// Gets the quanity amount for the variant sku (if any)
        /// </summary>
        /// <param name="variantSku">the variant's sku</param>
        /// <returns>quantity of item in the user's basket</returns>
        private int GetOrderLineQuantity(string variantSku)
            var quantityOfVariantInBasket = 0;
            if (!TransactionLibrary.HasBasket()) return quantityOfVariantInBasket;
            var basket = TransactionLibrary.GetBasket(true);
            if (basket == null) return quantityOfVariantInBasket;
            foreach (var orderLine in basket.PurchaseOrder.OrderLines)
                if (!orderLine.VariantSku.Equals(variantSku)) continue;
                quantityOfVariantInBasket = orderLine.Quantity;

            return quantityOfVariantInBasket;

THE ERROR: error as seen in visual studio THE LINE OF CODE: summarized custom controller

Charles Jones Fri, 29 Apr 2016 20:19:21 +00:00
umbracofile img src html not well formed Hello, I am trying to use the NivoSlider but when the view tries to fill in the src tag of the image with a call to umbracofile it is getting populated with this:

src='{ "src": "/media/1038/slide2.jpg", "focalPoint": { "left": 0.48785425101214575, "top": 0.49685534591194969 } }'

which breaks the image display.

the call is src='@image.GetPropertyValue("UmbracoFile")'

I would go directly to the URL if I knew how but I'm not sure how to see what properties can be used with the default media object.

any help would be appreciated.

Robert Leet Fri, 29 Apr 2016 17:46:22 +00:00
404 error on photos uploaded via Media Uploader. I uploaded images via the Desktop Media Uploader and on the home page they display fine. On a sub page when I use the "insert/edit image" icon, it shows the image in the editor page, but when I publish the page it shows a broken image box and 404 message. I have re-sized the images multiple times with the same results.

showing image in editor

broken image when published

Skyler Poston Fri, 29 Apr 2016 16:39:57 +00:00
Issue with Image Cropper I've been trying to use the Image Cropper and run into an issue. I have created a custom data type for my cropper so it can only be used for this particular document type:

enter image description here I then updated the doc type :

enter image description here

Lastly I went into my content to upload an image and there's no upload image option - rendering it pretty useless...

enter image description here

I also tried just adding an extra crop size to the standard 'Image Cropper' Data type but this rendered the same results. The only way I managed to get round it was by uploading an image directly into the media folder - which isn't really ideal..

Has anyone else run into this issue? Please help !

Vickie Allen Fri, 29 Apr 2016 15:29:48 +00:00
Multinode - Tree Picker
  • The Multinode - Tree picker is no longer fit for purpose when used to select media content
  • The Multinode - Tree picker is no longer fit for purpose when used to select media content

    • Compare the user interface to the default media picker -

    Compare the user interface to the default media picker  -

    • Please bring back the ability to navigate the media folders

    Umbraco 7.4.3

    Nigel Fri, 29 Apr 2016 15:17:20 +00:00
    Manually triggering db upgrade I am in the process of upgrading from 6.1.1. to 7.4.3 and I am doing it in a separate branch in TFS and a clone of our db as of about a week ago. my question is, once I am done migrating all the code, and am happy with the state of the upgrade, can I take a current clone of the db and remigrate just the db and refresh the indexes and umbraco.config and I can use this as the new prod db.


    Thanks Again, Devin

    Devin Gleason Lambert Fri, 29 Apr 2016 14:35:27 +00:00
    Inline styles and italics are not working Hi Team,

    PDF creator License No : 4503144636 / SA016785 / PU015212

    We are facing few queries while implementing the PDF generator in project.

    Following are the Questions i need clarification's.

    1. Is there any way to process inline styles
    2. It seems that Underlines are not coming in the PDF
    3. There are some custom tag in the HTML can we add razor to process the same.
    4. Chances of outdated tags are there will it be processed ie : both the following tags (<b>, <strong>) will get processed ?

    Sai Raj R

    Sai Raj R Fri, 29 Apr 2016 14:06:06 +00:00
    Cache Syncing in load balancing environment in 7.4 Has anyone tried load balancing in 7.4? this is one of the setups I am not very comfortable with. In the past, upgrading has been a pain to me and that is just upgrading.. (when we upgraded from 7.1 to 7.3, the site just failed and we had to stay up for 2 hours trying to figure it out. we eventually never got the upgrade)

    My biggest concern is the cache syncing:

    there doesnt seem to be any exact resolution to this.

    Does anyone know if this has been resolved in 7.4?

    denisedelbando Fri, 29 Apr 2016 13:52:38 +00:00
    Pass the same breadscrumb value to across to the umbraco templates. Hi,

    Is there Any possibility to Send the BreadScrumb value to across Multiple templates,

    _First -second -third -fourth

    Here The FIrst temple under have two templates if select the breadscrumb by using partial i have passed to this templates if selecting the Third:i have breadscrumb value is:Start/first/second/third

    The fourth template is not under first it has the saparate page /template if selecting i got breadscrumb value is:Start/fourth

    Is there any possibility to send same breadscrumb value of this Fourth Template i want to Start/first/second/fourth

    Raja Fri, 29 Apr 2016 13:25:41 +00:00
    Publish/Unpublish not working We are experiencing an issue with one of our live websites in that the publish/unpublish functionality has suddenly stopped working.

    I have checked the logs and am unable to see anything in there that might give a hint as to why this isn't working.

    Does anyone have any idea as to what the issue might be or have ideas about how I can find out what is causing the issue?

    Graham Carr Fri, 29 Apr 2016 13:24:04 +00:00
    Umbraco 7.4 + azure + ClearDb MySQL = constraint errors? Can anyone som shed light on this matter for me =)

    Cannot add or update a child row: a foreign key constraint fails (`DB`.`cmspropertydata`, CONSTRAINT `cmspropertydata_ibfk_1` FOREIGN KEY (`contentNodeId`) REFERENCES `umbraconode` (`id`))
     at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
       at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
       at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)
       at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
       at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
       at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
       at MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar()
       at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteScalar()
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClassa.<ExecuteScalarWithRetry>b__9()
       at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy cmdRetryPolicy, RetryPolicy conRetryPolicy)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy retryPolicy)
       at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command)
       at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
    Dennis Öhman Fri, 29 Apr 2016 13:07:58 +00:00
    Can't see Editor Notes data type Have installed but can't see the new Data Type in the drop down list. Have refreshed cache, logged out and back in again and touched web.config all without any effect. (Am using Umbraco version 7.4.2) ... Any ideas?

    Essy Fri, 29 Apr 2016 11:00:40 +00:00
    Deploy issue throws error 502.3 Hello everyone, I came on this forum because I need desperately some help to resolve one problem that I can't figure out from weeks.

    I deployed a clean installation of Umbraco 7 into my hosting provider server and after the wizard built up the database, every other request throws error 502.3 bad gateway after like 15 minutes of pending request.

    I tried to build the database both with compact edition and sql server, I tried to contact the hosting assistance to check for permissions and they told me what there full control all over the web site folders and the issue came up because the application can't open write.lock files in app_data\temp\folders.

    How can I fix this lock? I simply uploaded a clean installation of Umbraco, I didn't modified anything.

    Thank you for any help you can give me

    Andrea Aratari Fri, 29 Apr 2016 10:08:08 +00:00
    Using LocalizationService to update LanguageText table I'm developing a package for Umbraco but I am having an issue with updating LanguageText values from a CSV. Could anyone give me any support or explain where I'm going wrong?

    Here is my Code:

    public void SaveLTNew()
                    var ls = ApplicationContext.Current.Services.LocalizationService; 
                    var myContext = Request.TryGetHttpContext();
                    List<string> values = new List<string>();
                    List<string> languages = new List<string>();
                    List<string> keys = new List<string>();
                        if (myContext.Success)
                            HttpPostedFileBase myFileNew = myContext.Result.Request.Files["file"];
                            List<DictionaryTranslation> _hello = new List<DictionaryTranslation>();
                            List<DictionaryTranslation> _submit = new List<DictionaryTranslation>();
                            List<DictionaryTranslation> _form = new List<DictionaryTranslation>();
                            List<DictionaryTranslation> _bootstrap = new List<DictionaryTranslation>();
                            List<DictionaryTranslation> _world = new List<DictionaryTranslation>();
                            List<DictionaryTranslation> _heaven = new List<DictionaryTranslation>();
                            List<DictionaryTranslation> _hell = new List<DictionaryTranslation>();
                            List<DictionaryTranslation> _this = new List<DictionaryTranslation>();
                            List<DictionaryTranslation> _sublime1 = new List<DictionaryTranslation>();
                            if (myFileNew == null)
                                throw new HttpException("Invalid File");
                                StreamReader csvreader = new StreamReader(myFileNew.InputStream);
                                while (!csvreader.EndOfStream)
                                    var line = csvreader.ReadLine();
                                    if (line != "Value")
                                    if (line != "languageId")
                                    if (line != "Key")
                             UmbracoDatabase db = ApplicationContext.DatabaseContext.Database;
                                var remove = new Sql("DELETE FROM cmsLanguageText");
                                int rem = db.Execute(remove);
                            foreach (string value in values)
                                List<DictionaryTranslation> langIds = new List<DictionaryTranslation>();
                                    var language = ls.GetLanguageByIsoCode("he-IL");
                                    var lang1 = ls.GetLanguageByIsoCode("ru");
                                    var lang2 = ls.GetLanguageByIsoCode("en-US");
                            if (keys != null)
                                DictionaryTranslation key = new DictionaryTranslation(language, value);
                                DictionaryTranslation key1 = new DictionaryTranslation(lang1, value);
                                DictionaryTranslation key2  = new DictionaryTranslation(lang2, value);
                                throw new HttpException("invalid values");
                            IDictionaryItem hello = ls.DictionaryItemExists("hello_button") ? ls.GetDictionaryItemByKey("hello_button") : new DictionaryItem("hello_button");
                            IDictionaryItem submit = ls.DictionaryItemExists("submit_button") ? ls.GetDictionaryItemByKey("submit_button") : new DictionaryItem("submit_button");
                            IDictionaryItem form = ls.DictionaryItemExists("form_button") ? ls.GetDictionaryItemByKey("form_button") : new DictionaryItem("form_button");
                            IDictionaryItem btstrp = ls.DictionaryItemExists("bootstrap_button") ? ls.GetDictionaryItemByKey("bootstrap_button") : new DictionaryItem("bootstrap_button");
                            IDictionaryItem world = ls.DictionaryItemExists("world_button") ? ls.GetDictionaryItemByKey("world_button") : new DictionaryItem("world_button");
                            IDictionaryItem heaven = ls.DictionaryItemExists("heaven_button") ? ls.GetDictionaryItemByKey("heaven_button") : new DictionaryItem("heaven_button");
                            IDictionaryItem hell = ls.DictionaryItemExists("hell_button") ? ls.GetDictionaryItemByKey("hell_button") : new DictionaryItem("hell_button");
                            IDictionaryItem This = ls.DictionaryItemExists("this_button") ? ls.GetDictionaryItemByKey("this_button") : new DictionaryItem("this_button");
                            IDictionaryItem sublime = ls.DictionaryItemExists("sublime_button") ? ls.GetDictionaryItemByKey("sublime_button") : new DictionaryItem("sublime_button");
                            hello.Translations = _hello;
                            submit.Translations = _submit;
                            form.Translations = _form;
                            btstrp.Translations = _bootstrap;
                            world.Translations = _world;
                            heaven.Translations = _heaven;
                            hell.Translations = _hell;
                            This.Translations = _this;
                            sublime.Translations = _sublime1;
                            //Save the values

    This is compiling and running but not adding anything into the database table, could anyone help me get the values from the one column in the CSV into the database using LocalisationService?

    Thanks in advance!

    Jonathan Ben Avraham Fri, 29 Apr 2016 09:49:43 +00:00
    Umbraco ModelsBuilder and Azure – performance issues Hi all,

    Lately we've been involved in designing and building a couple of large(ish) sites that will be hosted on Azure. In one of the sites, we made extensive use of the fabulous new ModelsBuilder to get strongly typed models for our doctypes. However, when doing a test import of some 1000 nodes of mock data, we found that the solution while running OK on our local IIS slowed to a crawl in the Azure stage environment. Even importing ~250 nodes showed a significant slowdown, and this is a site which can easily encompass several thousand nodes in a few years.

    I tested creating an almost empty template, only including a line fetching a node the "classical" way:

    var viewmodel = Umbraco.TypedContentAtRoot().First().Children.Where(x => x.DocumentTypeAlias == "settings").First();

    But even this took several seconds to render.

    Refactoring the views and partial views to fetch properties via GetPropertyValue and then turning off the ModelsBuilder in web.config brought the render time of the start page from two minutes to ten seconds (still a bit slow, but that can be assuaged by caching).

    The Umbraco back end has felt snappy(ish) the entire time, which makes me suspect it has something to do with the way ModelsBuilder handles the Umbraco cache and how this is handled in an Azure environment. Note that my testing template did not use any model casting but was still slowed down immensely when ModelsBuilder was active.

    Has anyone else run into this? Any workarounds? We LOVE the ModelsBuilder otherwise and would very much want to be able to use it further.

    Janne Mårtensgård Fri, 29 Apr 2016 09:36:04 +00:00
    How to load CSS frameworks inside customized property editor without affecting Umbraco UI? I want to create a customized property editor with drag and drop interface.

    Using asset service I have loaded Materilaize framework and semantic UI in property editor controller js.

    After loading these frameworks, Entire Umbraco UI is not functioning properly. Umbraco UI picked up these loaded CSS framwork styles. How to avoid cascading?

    How to load CSS frameworks without affecting Umbraco UI?

    //inject umbracos assetsService
    function ($scope,assetsService) {
    //tell the assetsService to load the markdown.editor libs from the markdown editors
    //plugin folder
        .then(function () {
            //this function will execute when all dependencies have loaded
            alert("editor dependencies loaded");
    //load the seperat css for the editor to avoid it blocking our js loading
    assetsService.loadCss("").then(function () {
                //this function will execute when all dependencies have loaded
                alert("editor dependencies loaded cs");
    Senthil Kumaran Chinnathambi Fri, 29 Apr 2016 09:26:30 +00:00
    XML Sitemap taking ages to load Hi Guys,

    I'm having some trouble with the sitemap on seo checker, when I try and access the sitemap it is taking longer than expected to load. Is there any sort of caching that can be done around it to speed up the load time?


    Nathan Sleigh Fri, 29 Apr 2016 08:56:50 +00:00
    can you add a Grid layout or basic text box within a form layout? Morning Nicholas

    is it possible to add a grid layout element within the layout of a form for example add a text title, textbox or image within the form rows?

    the picture attached is an example of what im looking to achieve.

    thanks once again.

    enter image description here

    Ian Gerdes Fri, 29 Apr 2016 08:04:01 +00:00
    Media & Image usage Dear community, please help, Is it any option to see if Image is used in content before deleting it?

    Māris Fri, 29 Apr 2016 07:02:19 +00:00
    Can not see published pages I am configuring a website on Umbraco, this site was working fine except there was one run time error on one page. To check detailed description of error, I set this key and uploaded the web.config.

    Now I can not see any pages at all, Umbraco says no content has been published and showing the welcome page it shows in the beginning.

    Rajesh Fri, 29 Apr 2016 06:37:22 +00:00
    Source code for umbraco v4.11 compatible version. ( Contribution ) Hi,
    I have a client with umbraco 4.11 and tag Manager. I've been asked to investigate the feasibility of adding a right click menu 'add' to create tags.

    Since it's MIT license I'm sure It would be fine to decompile and add the feature, but if the source is available that would be even better. I could also send you a pull request if this goes ahead.

    Cheers. Murray.

    Murray Roke Fri, 29 Apr 2016 02:16:42 +00:00
    uBlogsy in Umbraco 7.3.4 with webforms??? Ok, before anyone blasts me for combining umbraco 7 with webforms to create a frankinBlog, let me state that we upgraded a webform site using umbraco 6.2.5 with uBlogsy 3.0.2 into a umbraco 7 webform site as per a client's request. Now, i'm stuck trying to connect ublogsy to this. the problem is that the original ublogsy on the site used masterpages and webforms that all connected to our topLevel.masterpage. Now, when i try using the last iteration of uBlogsy webforms (3.0.2) if fails to work because it requires Microsoft.Web.Helpers.dll, which is incompatible with umbraco 7. So, instead I tried using the newest mvc version of uBlogsy but i can no longer connect it to my webform masterpages (at least I dont think i can). No one here programs in mvc/razor, so doing so is difficult.

    Any suggestions as to what version of uBlogsy i should use for umbraco 7.3.4 with webforms? And more importantly, any way to connect it to our existing masterpages?

    For reference, the following is the blog page i'm upgrading. this is the umbraco 6.2.5 webforms that we're upgrading to the latest 7:

    James Fifth Thu, 28 Apr 2016 21:17:20 +00:00
    Field Concatenating Have a couple licensed domain versions and now looking for another - great product. New question for this domain. Is it possible to concatenate field names to create the node name during import?

    J. B. Thu, 28 Apr 2016 17:06:49 +00:00
    Uploading files to media gives "internal server error" My development platform is on Windows 10 and I'm using VS2013.

    The site works fine and is working on the operational platform. Until now on the development platform, I've been using IIS Express - no problems.. But now I've changed to the Local IIS and the media files have the following problems:

    1 If I run the site there are no errors but the images do not display. The URL is localhost/MySite/MyPage/ and the src for the image is /images/1234/image.jpg. I think it's concatenating the URL to localhost/MySite/MyPage/images/1234/image.jpg. If I try localhost/MySite/images/1234/image.jpg the image displays.

    2 In the back office, if I go to the Media section and select any previously uploaded image, I get the red cross and the image doesn't display. If I try to upload another image I get "internal server error".

    What have I done wrong?

    Your help would be much appreciated.

    Thanking you in anticipation.


    Roger Withnell Thu, 28 Apr 2016 16:26:49 +00:00
    Umbraco not updating correctly after a save Hi All,

    OK, so to explain, I have an older site running on Umbraco 6.2.5, recently we have been having problems with it when the client updates some of the content and saves, the content is not updating on the site. The content is saving, but no change on the actual site.

    There were some issues of "Oops: this document is published but is not in the cache", but that appears to have cleared up for now, but don't take this as a given, there is a good chance the client would forget to tell me if it was back.

    The site is running on a single VPS installation (it's not load balanced). It's running on SQLExpress, Windows 2008 R2. 3Gb of ram.

    My bosses had a 3rd party developer look at the site who said "I think it has too many nodes, Umbraco is well known for falling over with too many nodes".

    So there are circa 2000 nodes in total. I have read about sites with 100,000, so I am guessing it's not that.

    The app_data/umbraco.config file is circa 3mb, so not exactly massive, although a lot bigger than most of our sites.

    I have done various mixes of the following:

    rebuild the umbraco.config file rebuild the app_data structure Use /umbraco/dialogs/republish.aspx?xml=true Republishing entire branches

    The other day I completely rebuilt the app_data structure, then ran /umbraco/dialogs/republish.aspx?xml=true. Everything was correct and up to date. The client then tried to change one thing, and that didn't update (so broken again).

    Can someone please point me in the right direct for fixing this. It doesn't seem to matter which branch they try making the changes in, the whole site appears to be affected.

    I don't think it is a server memory issue. There's a bit of memory free and the rest is sucked up by various caches. This is pretty much the only site I am having issues with. There is plenty of disc space.

    Before someone suggest moving to Umbraco 7.x, it's not currently an option, there's some legacy code that would be unsupported on 7, which the client is currently not prepared to spend the money on getting recoded.

    Please help I have lost 10's of hours, perhaps even 100's "fixing" this annoying site.

    If you need more info please let me know.



    Stephen Thu, 28 Apr 2016 15:33:31 +00:00
    How to pass values from one page to another without using Querystring Hi,

    I have a requirement to pass few color code values from one page to another. How do i do it without passing the values in the URL?

    In the parent page, I have a list of brand names, each brands has its own color codes. So when i click the link of any particular brand, I am redirecting to a common page where I have to update text heading, sub menu back ground color based on the brand name click.

    Can I use macro to set values in parent page and read it in the sub page? or Is there any other way?

    would be good, if i get some sample piece of code.

    Sylvester Thu, 28 Apr 2016 06:10:02 +00:00
    Render from 2nd document type in Nested Content I am unable to render anything from a 2nd document type in a NC.

    Everything renders fine for the first doc type using:

    var items = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("contentBlock"); 

    How do you access the 2nd (or 3rd etc.) doc type that is a part of a NC?

    Thanks for any help!

    Dustin Schneider Wed, 27 Apr 2016 22:46:52 +00:00
    Link text Image Item property Hi All

    I'm trying to get a property from an image but keep getting the error that the property cannot be null. The code below workes but I want to add an imageItem property called caption, which is just a text field. so that the user can change the link text I've tried @imageItem.GetPropertyValue("caption") but still get the same error. Can anyone help.

    Thanks in advance Natasha

    <div class="carousel-caption">
                      <p style="padding:10px 10px; background-color:rgba(73,68,68,.5);display:block; height:auto;max-width:550px;">
                                <!-- now convert to a Json object-->
                                string jsonStr = @imageItem.GetPropertyValue("linkPicker").ToString();
                                var jsonObj = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(jsonStr);
                                  var link = Umbraco.TypedContent(Convert.ToInt16(@jsonObj["id"].ToString()));
                                  <a href="@link.Url" style="color:#fff; font-weight:bold;">
                            Click here to find out more
    Natasha Wed, 27 Apr 2016 13:57:09 +00:00
    List Merchello featured products on existing home node Hi Is there a way of listing products in existing home node that using Umbraco.Web.Mvc.UmbracoTemplatePage. My Marchello is now located in App_Plugins. Or is there any way of adding collections/products as a subitems on the categories? -Tor

    Tor Erik Skogen Tue, 26 Apr 2016 11:59:34 +00:00
    Umbraco Publish At Feature not working Umbraco Publish at Feature not working on version 7.2.8. Can any one please help. In log I am getting the below error. 2016-04-25 07:03:46,011 [119] ERROR Umbraco.Web.Scheduling.ScheduledPublishing - [P10908/T96/D17] Failed (at ""). System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xx:xx:xx:xxx:80 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context) at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) --- End of inner exception stack trace --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Umbraco.Web.Scheduling.ScheduledPublishing.d__5.MoveNext()

    I am having two servers staging and live. In staging it seems to work fine. The issue is with the live server

    Vinoj Kumar Mon, 25 Apr 2016 06:15:40 +00:00
    Cannot AddModelError during HttpPost in SurfaceController When validating a model in a SurfaceController during a form post back I'm unable to use ModelState.AddModelError to add validation error messages for providing feedback to the user. Any ideas why?

    I can use ModelState.AddModelError in [ChildActionOnly] rendering method without issue.

    public ActionResult VerifyEmail(VerifyEmailModel model)
        // This DOES work
        ModelState.AddModelError("SomeProperty", "Some error message to display.");
        return View(model);
    public ActionResult VerifyEmailSubmit(VerifyEmailModel model)
        // This DOESN'T work
        ModelState.AddModelError("SomeProperty", "Some error message to display.");
        return CurrentUmbracoPage();

    Any ideas how to get around this issue?

    I guess I can try to code up custom a System.ComponentModel.DataAnnotations.ValidationAttribute but the validation I need to do requires looking up data based on other model properties so starts to get a bit complex.

    Gavin Harriss Thu, 07 Apr 2016 20:45:24 +00:00
    Umbraco forms Go To Page On Submit used ID instead of uniqueID field The issue is, When Umbraco forms links the "Go To Page On Submit" page to a form, it uses the ID (not the uniqueID) of the target page. When the Form and the target submit page are both deployed from the authoring to production environment, the page ID does not get duplicated, however, the Form still tries to direct to the same ID when the form is submitted.

    The uniqueID does get duplicated when deployed. Why does Umbraco forms use the ID and not the uniqueID? Is there a fix for this?

    Andy Vennells Tue, 05 Apr 2016 23:24:04 +00:00
    A call to SetSessionId must occur before getting/setting a session or transaction While i was packaging a large set of documents and images (image cropper), this error occured about halfway there.

    Could anyone please describe what may be the error here?

    Also i am using UaaS.

    As an offtopic, how would you go about packaging/deploying ~2000 documents in UaaS?

    Something went wrong :(

    Here is some technical information that might help shed some light on whats happened:

    { "id": "fa239647-c8ff-4f02-bafc-260dc5b31867", "currentActivity": "Packaging: Document Dessertgrød med kaffe og chokolade Property Data", "name": "Umbraco.Courier.Core.Tasks.PackagingTask", "description": "Packaging revision: {0}", "total": 4510, "done": 2346, "complete": false, "error": false, "exception": null, "errors": null } Message: An error has occurred.

    Exception Message: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Umbraco.Courier.Core.Exceptions.RetrieveException: Error retrieving item [0d825241-1fb1-4945-bab3-bd0637a5dc39] from provider [e0472594-e73b-11df-9492-0800200c9a66]. ---> System.InvalidOperationException: A call to SetSessionId must occur before getting/setting a session or transaction at Umbraco.Courier.Persistence.V6.NHibernate.NHibernateGlobalSessionManager.get_ThreadSession() at Umbraco.Courier.Persistence.V6.NHibernate.NHibernateSessionManagerBase.GetSession(IInterceptor interceptor) at Umbraco.Courier.Persistence.V6.NHibernate.NHibernateGlobalSessionManager.GetSession() at Umbraco.Courier.Persistence.V6.NHibernate.NHibernateProvider.GetCurrentSession() at Umbraco.Courier.Persistence.V6.NHibernate.Persisters.NHibernateItemCrud1.GetCurrentSession() at Umbraco.Courier.Persistence.V6.NHibernate.Persisters.ContentPropertyDataItem.RetrieveItem(ItemIdentifier itemId) at Umbraco.Courier.Core.ItemCrud1.RetrieveItem[T1](ItemIdentifier itemId) at Umbraco.Courier.Core.ItemCrudProvider.RetrieveItem[T](ItemIdentifier itemId) --- End of inner exception stack trace --- at Umbraco.Courier.Core.ItemCrudProvider.RetrieveItem[T](ItemIdentifier itemId) at Umbraco.Courier.ItemProviders.PropertyItemProvider.HandlePack(ItemIdentifier id) at Umbraco.Courier.Core.ItemProvider.Package(ItemIdentifier id) at Umbraco.Courier.RepositoryProviders.Local.Package(ItemIdentifier itemId) at Umbraco.Courier.RepositoryProviders.Local.Hash(ItemIdentifier itemId) at Umbraco.Courier.RepositoryProviders.Webservices.Repository.GetItemHash(String sessionKey, ItemIdentifier itemId, String user, String pass) --- End of inner exception stack trace ---

    Exception Type: System.Web.Services.Protocols.SoapException

    Stack Trace: at Concorde.CacheHandler.UI.Controllers.DeployController.GetProcessedTask(Guid id) at Concorde.CacheHandler.UI.Controllers.DeployController.GetTask(Guid id) at Concorde.CacheHandler.UI.Controllers.DeployController.CurrentTaskStatus() at lambdamethod(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>cDisplayClass10.b9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.d0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.d5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.d2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.d_1.MoveNext()

    • Mathias
    Mathias Poulsen Thu, 10 Mar 2016 12:36:49 +00:00
    Styles not working and menu items missing from rich text editor. I'm just trying out Umbraco, evaluating it as an alternative to the Orchard CMS system, which I've been using for clients for a while now.

    I have a couple of questions I am hoping you can help me with.

    Firstly I am unable to apply styles in rich text editors using the format function, also most of the options such as html, cut, link etc are missing from the menu the same menu.

    I've had a look under Developer > Rich Text Editor, and all those items are checked to be included. Including the custom style sheet I created (which is working under Settings>StyleSheet>Styles>MyTestStyle).

    None of those items show up in the menu as I said above, and the custom style is missing from the Format drop down menu.

    Also trying to apply a style from the Format menu does nothing.

    Here's my setup:

    I am running the website through Visual Studio and a hosting the database on a local MSSQL 2012 server. I started a new empty ASP.NET 4.6 Web Application, then installed UmbracoCMS 7.0.4 using the available NuGet package.

    Using the standard Fanoe template that I'm modifying for my own site.

    On a slightly different subject but somewhat related, how would I go about applying a style to one of the div's for example in a page. I see no way to directly apply a class or id to those elements?

    Thanks for taking the time to read my message, Styrmir.

    Styrmir Mon, 07 Mar 2016 19:31:41 +00:00
    How to Auto-fill umbracoUrlAlias with Friendly URL Hi there everyone.

    I've got a situation where I need to auto-fill the umbracoUrlAlias field with the Page Name turned friendly URL.

    The purpose being my client does not like the page URLs following the node path, no matter how deep the page is he wants it to render like "".

    I've found/implemented a way to change all the links to the alias once it's set via this post.

    Now all I need is to auto-fill the alias field so any help with that would be appreciated, or if you know a better way of accomplishing this task I'm all ears.

    I'm new to Umbraco, so be easy on me if I'm blundering around. :)


    Elijah Fowler Wed, 02 Mar 2016 22:06:45 +00:00
    Umbraco 7: How to put a newly created node on top [UPDATED]

    After finding Simon Dingley's SO post on "Umbraco 6: How to put newly created node on top" I've tried to implement the sorting but I think things have changed enough that this doesn't seem to actually work and the new node is placed at the bottom of the list of any siblings instead of at the top where I need it to be?

    Also, the duplicate check seems to be failing as multiple nodes are being created at different levels at different times if anyone can see where that's wrong?

    Here's an image as an example of the replication issue:

    enter image description here

    If the nodes are manually sorted to put the module manager at the top - the duplication doesn't happen of course as the "found" flag is triggered immediately in the loop but then is ignored as it loops through the children?

    Here's the latest code:

    using System;using System.Diagnostics;
    using System.Linq;
    using Umbraco.Core;
    using Umbraco.Core.Events;
    using Umbraco.Core.Logging;
    using Umbraco.Core.Models;
    using Umbraco.Core.Services;
    namespace NG.USK.Helpers
      /// <summary>
      /// Check for a child page element for each of the main parent document types to enable the usage of the individual functionality module plugins
      /// </summary>
      public class CreatePageElements : ApplicationEventHandler
        public CreatePageElements()
          ContentService.Saved += ContentService_Saved;
        private static void ContentService_Saved(IContentService sender, SaveEventArgs<IContent> args)
          foreach (
            var node in
                node =>
                  node.ContentType.Alias.InvariantEquals("NG_USK_Homepage") ||
                  node.ContentType.Alias.InvariantEquals("NG_USK_StandardPage") ||
                  node.ContentType.Alias.InvariantEquals("NG_USK_StandardPageChild") ||
                  node.ContentType.Alias.InvariantEquals("NG_USK_NewsArticle") ||
              if (!node.Children().Any())
                var ignore = false;
                foreach ( var child in node.Children())
                  if (child.ContentType.Alias.InvariantEquals("NG_USK__PageElements"))
                    ignore = true;
                  if (ignore == false)
            catch (Exception err)
              // Get stack trace for the exception with source file information
              var st = new StackTrace(err, true);
              // Get the top stack frame
              var frame = st.GetFrame(0);
              // Get the line number from the stack frame
              var line = frame.GetFileLineNumber();
              LogHelper.Warn(typeof(CreatePageElements), "ERROR ON: ContentService_Saved - " + node.ContentType.Alias + " ~ " + err.Message + "[" + line + "]:" + st);
        private static void MakePageElements(IContent node)
          if (
              node.ContentType.Alias.InvariantEquals("NG_USK__AutoRedirect") ||
          var nodeName = node.Name;
          var pageModuleName = nodeName + " Modules";
          var cs = ApplicationContext.Current.Services.ContentService;
          var elementsNode = cs.CreateContent(pageModuleName, node.Id, "NG_USK__PageElements");
          //get the new node's parent
          var parentNode = elementsNode.Parent();
          //Check if parentNode.Children is greater than just the new elementNode to squish the "Sequence contains no elements" error
          if (parentNode.Children().Count() > 1)
            //move the node to the first child: <-- THIS IS WHERE IT FALLS OVER!!!!
            elementsNode.SortOrder = parentNode.Children().OrderBy(n => n.SortOrder).First().SortOrder - 1;
            elementsNode.SortOrder = 0;
          //Get this value again for logging:
          var hider = string.Empty;
          //Make sure the element has the NaviHide property available
          if (elementsNode.HasProperty("umbracoNaviHide"))
            //tell it to have the NaviHide Property set to true:
            elementsNode.SetValue("umbracoNaviHide", true);
            //Get this value again for logging:
            hider = elementsNode.GetValue<string>("umbracoNaviHide") == "0" ? "hide" : "show";
          //Log this to the TraceLog
          LogHelper.Info(typeof(CreatePageElements), "DETAILS ON: " + elementsNode.Name + " is now the " + elementsNode.SortOrder + " child of " + parentNode.Name + " and set to " + hider);
          //save and publish

    Thanks everyone!

    Jon R. Humphrey Fri, 08 Jan 2016 01:38:37 +00:00
    How to get collections (categories) Hi,

    I have some collections in Merchello where I categorize my products.

    I want to achieve something like this:

    • Category 1 (5)
    • Category 2 (10)
    • Category 3 (6) ...

    I succeeded to make the collections and linked the products to the different collections, but now I want to access them in my front-end.

    How can I achieve that? I already checked merchelloHelper.Query.Products but there is no collections property available.

    I hope I don't have to make the full category structure in Umbraco, because I then have to do things twice.

    Is there an easy way to access all my collections in Merchello?

    Thanks for your help.

    Jurgen Van de Water Sun, 27 Dec 2015 11:47:52 +00:00
    How do you use DatabaseSchemaHelper to create SQL tables etc. with PetaPoco? I've been dynamically creating SQL tables using PetaPoco in Umbraco 7. Some example code to give an idea of what I've been doing:

    public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        //Get the Umbraco Database context
        var db = applicationContext.DatabaseContext.Database;
        //Check if the DB table does NOT exist
        if (!db.TableExist("JobAlertQueue"))
            //Create DB table - and set overwrite to false

    So in this example it checks whether a table exists and, if not, creates one. This all works fine. However, since Umbraco 7.3.x it appears the CreateTable<T> extension has been deprecated in favour of DatabaseSchemaHelper.

    So now I get compiler warnings like:

    'Umbraco.Core.Persistence.PetaPocoExtensions.CreateTable<T>(Umbraco.Core.Persistence.Database, bool)' is obsolete: 'Use the DatabaseSchemaHelper instead'
    'Umbraco.Core.Persistence.PetaPocoExtensions.TableExist(Umbraco.Core.Persistence.UmbracoDatabase, string)' is obsolete: 'Use the DatabaseSchemaHelper instead'

    However I can't find any documentation on how to use the DatabaseSchemaHelper to do this. I'm not even sure how you get an instance of the class - does it follow the singleton convention like the ApplicationContext.Services or do you need to construct it? If the latter, how do you construct it - the signature is confusing:

    DatabaseSchemaHelper(Database db, ILogger logger, ISqlSyntaxProvider syntaxProvider);

    How do I get an instance of an SqlSyntaxProvider?

    Anyone know how to migrate to using DatabaseSchemaHelper?

    Dan Diplo Mon, 21 Dec 2015 12:04:16 +00:00
    Check if Umbraco Grid is empty Hi! :-)

    Is there a way to check if the Umbraco Grid is empty?

    Because when i get the "PropertyValue", it's not empty or null.

    Anders Brohus Tue, 01 Dec 2015 09:17:47 +00:00
    Howto: Add PDF Searching to ezSearch Install-Package UmbracoCms.UmbracoExamine.PDF

    Then update /Views/MacroPartials/ezSearch.cshtml around line 145

    model.AllResults = results;
    model.AllResults = model.AllResults.Concat(searcherPdf.Search(model.SearchTerm, true).Where(i => !model.AllResults.Any(j => j.Id == i.Id)));
    model.AllResults = model.AllResults.OrderByDescending(i => i.Score).ToList();

    then around line 230

           case UmbracoExamine.IndexTypes.Media:
                var mediaItem = Umbraco.TypedMedia(result.Id);
                @RenderMediaResult(model, mediaItem)

    Thanks for the package Matt! BTW, buy a licence for itext if your project is not open source!

    Ben Norman Fri, 09 Oct 2015 03:03:44 +00:00
    Autosort for Umbraco 7 Hi..

    Are there any plans to create a version of this package for Umbraco 7?

    or maybe submit a pull request to the core?

    Maybe it does not need to have its own context menu, but could extend the existing sort dialog view and controller?


    Bjarne Fyrstenborg Thu, 24 Sep 2015 06:05:20 +00:00
    Something went wrong with this editor, below is the data stored: Hi,

    After an upgrade of Umbraco some content in backend will not render when opening an item in backend. The front-end works fine, but I get (for some parts of an item) only JSON like this: Something went wrong with this editor, below is the data stored:

    It informs that "Something went wrong with this editor, below is the data stored:", but I not sure what to do to fix this issue.

    It is a big problem as I cannot edit content.

    Can anyone advice me what to do about this issue? Thanks.


    Sten Hougaard Fri, 14 Aug 2015 13:18:37 +00:00
    Forms tables missing in db Hi,

    installing the Forms Plugin in Umbraco 7.2.2. worked without any exceptions.

    But the Forms Database schema is missing!
    We get following message when we try to send a Form - 
    "Invalid object name 'UFRecords'"

    How can I create the db related stuff by hand?
    The db user in our web.config connectionstring should have enough rights.

    Regards, fabian

    Fabian Fri, 27 Feb 2015 12:06:33 +00:00
    Bug: Local link in rich text editor doesn't render correctly Hello,

    When adding a local link in the rich text editor within a U7 grid (via "Insert/edit link" and selecting a document), the front end renders the link as follows:

    <a href="/{localLink:[id]}">Text</a>

    For now, our work-around is to hard-code the relative path, but obviously that's not ideal.

    Keith Donnell Tue, 27 Jan 2015 23:57:07 +00:00
    CMS nodes Not holding on to updates. Change not showing in Umbraco.config v6.16 Environment:
    Our client is running an Umbraco v6.16 instance configured for Web Forms in IIS. The site is not load balanced.

    When we make changes to a node in the CMS and then save and publish it, we see the message that it has been saved and published successfully, but the node doesn’t always show or hold on to the updates.

    Additionally the changes do not show up in Frontend of the site. We tried several “Republish Entire Site” commands, “Reload Nodes” commands, logging out and logging back in, and even clearing our browser cache but to no avail.

    The only thing that seems to work is if we “leave it alone”. Eventually the changes show up in Umbraco.config. Nodes will show and hold on to the changes in the CMS and then show up in the front end of the site. 

    What we know is happening:
    We were able to confirm the changes show up in the Examine Indexes, we unable to confirm if they show up in the database yet, but that will be our next check once we get access.

    We grabbed a copy of the umbraco.config and were able to confirm that the changes were not being written there.


    Possible Suspicion:
    We're having our client’s server admin check the permissions to umbraco.config and App_Data folder as described in this stackoverflow article  as it seems very similar to what we are experiencing. 


    Anyone have any thought on what could be causing this or items we should check?

    Robert Martine-McEvoy Thu, 08 Jan 2015 21:32:24 +00:00
    Recursively get all umbraco content, also unpublished, like the content tree,-also-unpublished,-like-the-content-tree,-also-unpublished,-like-the-content-tree Hi,

    I'm speaking about umbraco 6.x, but maybe the logic is similar for umbraco 7, so even who is using umbraco 7 can help to answer this?

    I'd like to create a report containing all the umbraco nodes, also the unpublished ones (the "documents").

    Umbraco shows those already, in the Content section.

    So maybe you can point me out to the umbraco source code, where the content tree is generated and I may re-use the same code/logic in my report.

    Or should this be as easy as using the Enumerating documents API Reference examples? If yes sorry for asking, but I wanted to be sure not to reinvent the wheel, when there is alrady some code available... ;-)

    Thank you for letting me know & cheers

    firepol Wed, 27 Aug 2014 11:15:24 +00:00
    Access navigationService and notificationService from iFrame Hi,

    I have been creating a custom section that wraps an existing MVC app, that has been moved into an area, and had it's navigation and menus ported to a custom section and tree.

    So far, so good, however, I have one final thing to figure out and I'm done (and I'll write a blog post about the whole process once I'm done, as it's been quite the learning experience).

    Does anyone know how to access the notification service, or navigation service, from within an iFrame in the back office. The pages are MVC, and aren't part of Umbraco. I would however, like to use the notification service to display alerts when things are done like clicking save, and reload the tree when I rename something in the MVC app.

    If I was using the old webforms, I'd just use the ClientTools class, but these pages aren't webforms, and they're not really part of the main Umbraco app, so I guess I'm going to have to do it all client side. I just can't figure out how to get a hold of the services from a non-angular bit of code in an iFrame.

    Any help or advice greatly appreciated!


    Tim Mon, 30 Jun 2014 13:21:01 +00:00
    how to get the current user with UserService I just upgraded a new project from Umb 7.0.3 to 7.1.0 and now Visual Studio is telling me that the way I get current user is deprecated. Specifically, this:


    now is tagged with:

    'umbraco.BusinessLogic.User' is obsolete: "Use the UserService instead"

    Which I'm attempted to do however I can find no way to get the current user via the UserService. I see methods to get users by their id, their username, their email address, etc. Which are all great but don't help me as I don't have any of that information. I just want to get the currently logged in user for error logging purposes. What am I overlooking?

    Chester Campbell Thu, 17 Apr 2014 19:52:27 +00:00
    Unable to publish - String or binary data would be truncated


    Using Umbraco v6.03

    I'm getting this error when trying to save or save and publish.

    We have been working on this site for serveral weeks now without problems until this morning.

    Any ideas?



    2013-04-22 09:35:30,421 [6] ERROR Umbraco.Core.UmbracoApplicationBase - [Thread 31] An unhandled exception occurred

    System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated.

    The statement has been terminated.

       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)

       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)

       at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()

       at System.Data.SqlClient.SqlDataReader.get_MetaData()

       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)

       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)

       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)

       at System.Data.SqlClient.SqlCommand.ExecuteScalar()

       at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)

       at Umbraco.Core.Persistence.Database.Insert(Object poco)

       at Umbraco.Core.Persistence.Repositories.ContentRepository.PersistUpdatedItem(IContent entity)

       at Umbraco.Core.Persistence.Repositories.RepositoryBase`2.PersistUpdatedItem(IEntity entity)

       at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit()

       at Umbraco.Core.Services.ContentService.SaveAndPublishDo(IContent content, Boolean omitCacheRefresh, Int32 userId, Boolean raiseEvents)

       at umbraco.cms.businesslogic.web.Document.PublishWithResult(User u)

       at umbraco.dialogs.publish.doPublishSubs(Document d)

       at umbraco.dialogs.publish.Page_Load(Object sender, EventArgs e)

       at umbraco.BasePages.BasePage.OnLoad(EventArgs e)

       at System.Web.UI.Control.LoadRecursive()

       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


       at System.Web.UI.Page.HandleError(Exception e)

       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

       at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

       at System.Web.UI.Page.ProcessRequest()

       at System.Web.UI.Page.ProcessRequest(HttpContext context)

       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    Stefan Arngrimsson Mon, 22 Apr 2013 11:44:48 +00:00
    ouch... forgot admin password. how to reset? I have a umbraco installation with some work done already but I supidly forgot the password of the only user... admin :-(

    In the umbracoUser table the password is hashed and clearing it does not help.

    How can I reset the password to "default"

    Nico Lubbers Tue, 20 Oct 2009 20:36:56 +00:00