C# 如何使用C在我的页面中实现Google地图#
我想在我的页面中实现谷歌地图。在我的页面中有一个文本框和一个按钮。用户需要输入他想要拥有地图的位置。然后单击按钮,地图应显示在div中 谁能给我提供这样做的STEOC# 如何使用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
提前谢谢。您可以使用.NET的一些C#控件,例如这一个:您可以使用.NET的一些C#控件,例如这一个:如果您使用google api js文件,这是非常容易的。作为参考,您可以使用以下链接:
<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文件,这非常容易。作为参考,您可以使用以下链接:
<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');
};
}
});