Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 带路径点的谷歌地图在aspx页面中不起作用,同样的东西在html中也起作用_Asp.net_Google Maps - Fatal编程技术网

Asp.net 带路径点的谷歌地图在aspx页面中不起作用,同样的东西在html中也起作用

Asp.net 带路径点的谷歌地图在aspx页面中不起作用,同样的东西在html中也起作用,asp.net,google-maps,Asp.net,Google Maps,下面的代码在html页面中工作,但当我在aspx页面中使用相同的代码时,地图不会出现。谁能看出我做错了什么 我有5个中途站作为航路点。我想在地图上显示所有这些点作为推送点和行驶路线 <html> <head> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script type="text/javas

下面的代码在html页面中工作,但当我在aspx页面中使用相同的代码时,地图不会出现。谁能看出我做错了什么

我有5个中途站作为航路点。我想在地图上显示所有这些点作为推送点和行驶路线

<html>
 <head>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    <script type="text/javascript">
        var directionsDisplay;
        var directionsService = new google.maps.DirectionsService();
        var map;

        function initialize() {
            directionsDisplay = new google.maps.DirectionsRenderer();
            var chicago = new google.maps.LatLng(17.42354, 78.46290);
            var mapOptions = {
                zoom: 6,
                mapTypeId: google.maps.MapTypeId.ROADMAP,
                center: chicago
            }
            map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

            directionsDisplay.setMap(map);

        }

        function calcRoute() {

            var start = "17.44438,78.44251";
            var end = "17.3687826,78.5246706";
            var waypts = [];
            waypts.push({
                location: "17.44438,78.44251",
                stopover: true
            });
            waypts.push({
                location: "17.413384,78.461142",
                stopover: true
            });
            waypts.push({
                location: "17.38364,78.466964",
                stopover: true
            });
            waypts.push({
                location: "17.3836013,78.4869135",
                stopover: true
            });
            waypts.push({
                location: "17.3687826,78.5246706",
                stopover: true
            });




            var request = {
                origin: start,
                destination: end,
                waypoints: waypts,
                optimizeWaypoints: true,
                travelMode: google.maps.TravelMode.DRIVING
            };
            directionsService.route(request, function (response, status) {
                if (status == google.maps.DirectionsStatus.OK) {
                    directionsDisplay.setDirections(response);

                }
            });
        }
        google.maps.event.addDomListener(window, 'load', initialize);
        window.onload = function () { initialize(); calcRoute(); };
    </script></head>
<body>
    <form id="form1" runat="server">

    <div id="map-canvas"></div>
    </form>
</body>
</html>

var方向显示;
var directionsService=new google.maps.directionsService();
var映射;
函数初始化(){
directionsDisplay=new google.maps.DirectionsRenderer();
var chicago=new google.maps.LatLng(17.42354,78.46290);
变量映射选项={
缩放:6,
mapTypeId:google.maps.mapTypeId.ROADMAP,
中心:芝加哥
}
map=new google.maps.map(document.getElementById('map-canvas'),mapOptions);
方向显示.setMap(地图);
}
函数calcRoute(){
var start=“17.44438,78.44251”;
var end=“17.3687826,78.5246706”;
var-waypts=[];
推({
地点:“17.44438,78.44251”,
中途停留:对
});
推({
地点:“17.413384,78.461142”,
中途停留:对
});
推({
地点:“17.38364,78.466964”,
中途停留:对
});
推({
地点:“17.3836013,78.4869135”,
中途停留:对
});
推({
地点:“17.3687826,78.5246706”,
中途停留:对
});
var请求={
来源:start,
目的地:完,
航路点:航路点,
航路点:对,
travelMode:google.maps.travelMode.DRIVING
};
路由(请求、功能(响应、状态){
if(status==google.maps.directionstatus.OK){
方向显示。设置方向(响应);
}
});
}
google.maps.event.addDomListener(窗口“加载”,初始化);
window.onload=函数(){initialize();calcRoute();};

必须指定为其指定贴图的div的高度和宽度


对于html,不需要指定宽度

必须指定为其指定贴图的div的高度和宽度


对于html,没有必要指定宽度

我不是一个ASP的家伙,但这可能与报价有关吗?我从R Square得到了解决方案。什么时候出现了id地图画布地图的div的宽度和高度。我不是ASP的人,但这可能与报价有关吗?我从R Square得到了解决方案。当给定id为map的div的宽度和高度时,画布映射出现。