Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Owen Parsons 5 posts 75 karma points
    Dec 04, 2018 @ 12:50
    Owen Parsons
    0

    Sequence contains no matching element (Multisite issue)

    I have a setup whereby I have two "Home" nodes, one for an English site the other for a German website. Each have there own Cultures/Languages set appropiately.

    In one partial view I have the below code snippet:

    @foreach (var branch in Umbraco.TypedContentAtRoot().Where(x => x.DocumentTypeAlias == Homepage.ModelTypeAlias))
                {
                    var culture = branch.GetCulture();
                    var region = new RegionInfo(culture.Name);
    
                    <option value="@branch.Url" @(Model.CurrentCulture.Name == culture.Name ? "selected=\"true\"" : "")>@region.EnglishName (@culture.Name)</option>
                }
    

    The English site: Run pefectly and the dropdown of sites is populated with the above code.

    However... the German website errors on this sames code. I've stepped through it and the data in the loop is identical, but after looping through the two sites, it throws this error:

    System.InvalidOperationException: 'Sequence contains no matching element'
    

    Has anyone ever had a similiar issue to this or have an idea of what could be going wrong. Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft