Search results

State Persistence in ASP.NET Core Maps control

22 Jul 2021 / 1 minute to read

State Persistence

State persistence allows the Maps to retain the current modal value in the browser cookies for state maintenance. This action is handled through the enablePersistence property which is set to false by default. When it is set to true, some of the Maps component model values will be retained even after refreshing the page.

Copied to clipboard
        var titleStyle = new MapsFont
            Size = "16px",
        var cluster = new MapsMarkerClusterSettings
            Shape= Syncfusion.EJ2.Maps.MarkerType.Image,
            LabelStyle= new MapsFont {

        var tooltip = new MapsTooltipSettings
            Visible = true,
            ValuePath = "city"

    <div class="control-section">
        <ejs-maps id="maps" format="n" useGroupingSeparator="true">
            <e-maps-titlesettings alignment="@Syncfusion.EJ2.Maps.Alignment.Center" text="Top 50 largest cities in the World" textStyle="titleStyle"></e-maps-titlesettings>
            <e-maps-zoomsettings enable="true"></e-maps-zoomsettings>
                <e-maps-layer shapeData="" markerClusterSettings="cluster">
                    <e-layersettings-shapesettings fill="#C1DFF5"></e-layersettings-shapesettings>
                        <e-layersettings-marker visible="true" shape="Image" imageUrl="../styles/images/maps/ballon.png" height="20" width="20" animationDuration="0" tooltipSettings="tooltip" dataSource="ViewBag.marker"></e-layersettings-marker>
Copied to clipboard
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Syncfusion.EJ2.Maps;
using System.Web.Script.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using EJ2MVCSampleBrowser.Models;

namespace EJ2MVCSampleBrowser.Controllers.Maps
    public partial class MapsController : Controller
        // GET: MarkerClustering
        public ActionResult MarkerClustering()
            ViewBag.shapeData = this.getWorldMap();
            ViewBag.ClusterData = this.ClusterData();
            return View();
        public object ClusterData()
            string allText = System.IO.File.ReadAllText(Server.MapPath("~/App_Data/MapData/ClusterData.json"));
            return JsonConvert.DeserializeObject(allText, typeof(object));