Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.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
C# 如何使用C在我的页面中实现Google地图#_C#_Google Maps - Fatal编程技术网

C# 如何使用C在我的页面中实现Google地图#

C# 如何使用C在我的页面中实现Google地图#,c#,google-maps,C#,Google Maps,我想在我的页面中实现谷歌地图。在我的页面中有一个文本框和一个按钮。用户需要输入他想要拥有地图的位置。然后单击按钮,地图应显示在div中 谁能给我提供这样做的STEO 提前谢谢。您可以使用.NET的一些C#控件,例如这一个:您可以使用.NET的一些C#控件,例如这一个:如果您使用google api js文件,这是非常容易的。作为参考,您可以使用以下链接: 在HEAD部分添加jQuery和GoogleMaps API库: <script type="text/javascript" src

我想在我的页面中实现谷歌地图。在我的页面中有一个文本框和一个按钮。用户需要输入他想要拥有地图的位置。然后单击按钮,地图应显示在div中

谁能给我提供这样做的STEO


提前谢谢。

您可以使用.NET的一些C#控件,例如这一个:

您可以使用.NET的一些C#控件,例如这一个:

如果您使用google api js文件,这是非常容易的。作为参考,您可以使用以下链接:

  • 在HEAD部分添加jQuery和GoogleMaps API库:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
    
  • 为按钮添加单击处理程序:

    $('#idMyButton').click(function() {
        if (geocoder) {
            var address = $('#idMyTextbox').val();
            geocoder.geocode( { 'address': address}, function(results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    /* Position the map */
                    map.panTo(results[0].geometry.location);
                    /* Put a marker */
                    new google.maps.Marker({
                        map: map,
                        position: results[0].geometry.location,
                        title: address,
                });
            }
            else
                alert('Address not found');
            };
        }
    });
    

  • 我希望这会有所帮助。

    如果您使用google api js文件,这非常容易。作为参考,您可以使用以下链接:

  • 在HEAD部分添加jQuery和GoogleMaps API库:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
    
  • 为按钮添加单击处理程序:

    $('#idMyButton').click(function() {
        if (geocoder) {
            var address = $('#idMyTextbox').val();
            geocoder.geocode( { 'address': address}, function(results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    /* Position the map */
                    map.panTo(results[0].geometry.location);
                    /* Put a marker */
                    new google.maps.Marker({
                        map: map,
                        position: results[0].geometry.location,
                        title: address,
                });
            }
            else
                alert('Address not found');
            };
        }
    });
    
  • 我希望这会有所帮助。

    你确定你是指C#,在我看来你想用Javascript在客户端执行此操作吗?你确定你是指C#,在我看来你想用Javascript在客户端执行此操作吗?