Copied to clipboard

Flag this post as spam?

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


  • DS 21 posts 162 karma points
    Jan 12, 2017 @ 20:50
    DS
    0

    MapBuilder: Error when using @Html.RenderMap()

    Per the documentation for this package, I have created a data source and a named map in the MapBuilder section. Next, I have called @Html.RenderMap(MAPALIAS) with the name of my map in my view.

    When attempting to load a test page with this view I receive this error:

    System.Web.Mvc.HtmlHelper

    • Is there a specific @using declaration I need to add for this package to work correctly?
    • I am running version Umbraco 7.5.3, does this package not support this version?

    Thank you

    My code for reference:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = "MasterLayout.cshtml";
    }
    <div class="body-container">
        <div class="center-content float-center">
    
            <div class="contentBox">
                <div class="goldstripe"></div>
                <span style="font-size: 12px">@Umbraco.RenderMacro("Breadcrumbs")</span>
                <h1 class="largeHeader show-for-large">@Umbraco.Field("pageName")</h1>
                <br/>
                @Html.RenderMap(allLocations)
            </div>
        </div>
    </div>
    
  • Kevin Jump 2348 posts 14896 karma points MVP 8x c-trib
    Jan 12, 2017 @ 20:54
    Kevin Jump
    100

    hi

    i think you need to include :

    @using MapBuilder.Library.ExtensionMethods
    

    or put the following line in namespaces section of the web.config in the views folder

    <add namespace="MapBuilder.Library.ExtensionMethods" />
    

    and it will be included on all razor scripts.

  • DS 21 posts 162 karma points
    Jan 12, 2017 @ 21:04
    DS
    0

    Thanks for the VERY fast response, that solved that problem.

    However, I am now receiving:

    The name 'allLocations' does not exist in the current context

    In reference to my map alias.

  • Kevin Jump 2348 posts 14896 karma points MVP 8x c-trib
    Jan 12, 2017 @ 21:25
    Kevin Jump
    0

    A slightly slower response then ;)

    I think the map alias needs to be a string, in your code allLocations is a variable that isn't set.

    I've never actually used this package, but I suspect the Alias had to be a string that maps to something in your config?

    Maybe putting quotes around allLocations might work?

  • DS 21 posts 162 karma points
    Jan 12, 2017 @ 22:07
    DS
    0

    Yep I figured that out, plus I changed the name to ensure it was unique.

    The page loads fine now. Unfortunately only the map container is being rendered, not the map itself.

    I think I may have to abandon this package if I can't get it working soon.

  • Mark Arndt Lønquist 20 posts 89 karma points
    Feb 08, 2017 @ 08:11
    Mark Arndt Lønquist
    0

    Did you setup the datasource in the mapbuilder section?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies