地图上的气球位置不正确

Baloon location on map is incorrect

我在视图中放置了 yandex 地图(google 地图的俄罗斯类似物)。但是但是气球的位置和坐标不符!

代码如下:

示例 #1 - 气球显示不正确

<script type="text/javascript">
    ymaps.ready(init);
    var myMap,
        myPlacemark;

    function init() {
        myMap = new ymaps.Map("map", {
            center: [55.76, 37.64],
            zoom: 10
        });

        @foreach (var person in Model)
        {
            <text>
        console.log('Service = @person.ServiceName, x = @person.CoordinateX, y = @person.CoordinateY');

        myPlacemark = new ymaps.Placemark([@(person.CoordinateX), @(person.CoordinateY)], {
            hintContent: '@(person.ServiceName)',
            balloonContent: '@(person.CoordinateX), @(person.CoordinateY)'
        });
        myMap.geoObjects.add(myPlacemark);
            </text>
        }
    }
</script>

但是如果我把它改成常量(不是循环"foreach"),一切正常:

示例 #2 - 气球显示正确

<script type="text/javascript">
    ymaps.ready(init);
    var myMap,
        myPlacemark;

    function init() {
        myMap = new ymaps.Map("map", {
            center: [55.76, 37.64],
            zoom: 10
        });

        myPlacemark = new ymaps.Placemark([55.871030, 37.658510], {
            hintContent: 'hint',
            balloonContent: 'content'
        });
        myMap.geoObjects.add(myPlacemark);

        myPlacemark = new ymaps.Placemark([55.782392, 37.614924], {
            hintContent: 'hint',
            balloonContent: 'content'
        });
        myMap.geoObjects.add(myPlacemark);
    }
</script>

注意: 在控制台的示例 #1 中,我得到了正确的值:

服务 = something1,x = 55,87103,y = 37,65851

服务 = something2,x = 55,782392,y = 37,614924

但是气球的位置与坐标不匹配:

Incorrect baloons positions on map

我们发现问题出在 ASP.Net 在发布的代码片段中输出数字的方式。它们被打印成带有浮动 逗号 而不是点的 JS 代码。