How To Show Google Map with Latitude and Longitude in Asp.net Website HTML Ans c# Asp.net
Program:
.Aspx File
Program:
.Aspx File
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Latitude and Longitude </title> <style type="text/css"> html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map_canvas { height: 100% } </style> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC6v5-2uaq_wusHDktM9ILcqIrlPtnZgEk&sensor=false"> </script> <script type="text/javascript"> function initialize() { var lat = document.getElementById('txtlat').value; var lon = document.getElementById('txtlon').value; var myLatlng = new google.maps.LatLng(lat, lon) var mapOptions = { center: myLatlng, zoom: 6, mapTypeId: google.maps.MapTypeId.ROADMAP, marker: true }; var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); var marker = new google.maps.Marker({ position: myLatlng }); marker.setMap(map); } </script> </head> <body > <form id="form1" runat="server"> <table> <tr> <td>Enter Latitude:</td> <td><input type="text" id="txtlat" value="21.195" /> </td> </tr> <tr> <td>Enter Longitude:</td> <td><input type="text" id="txtlon" value="72.819443999999999999" /> </td> </tr> <tr> <td></td> <td><input type="button" value="Submit" onclick="javascript:initialize()" /> </td> </tr> </table> <div id="map_canvas" style="width: 500px; height: 400px"></div> </form> </body> </html> |
Demo:
|
No comments:
Post a Comment