Sujeesh ck

Sujeesh ck

  • 1.2k
  • 495
  • 5.5k

Google Map multiple routes using Asp.Net

Feb 26 2019 1:14 PM
Hi ,
 
I am tired to create a routes in google map through javascript using asp.net. But it is not loaded propely and also getting the developer version map. So please help me to complete the work.
 
1. Can i get the source code to implement the route map in the Asp.net.
 
Code Side
  1. <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>  
  2. <script language="javascript" type="text/javascript">  
  3. var directionsDisplay;  
  4. var directionsService = new google.maps.DirectionsService();  
  5. function InitializeMap() {  
  6. directionsDisplay = new google.maps.DirectionsRenderer();  
  7. var latlng = new google.maps.LatLng(-34.397, 150.644);  
  8. var myOptions =  
  9. {  
  10. zoom: 8,  
  11. center: latlng,  
  12. mapTypeId: google.maps.MapTypeId.ROADMAP  
  13. };  
  14. var map = new google.maps.Map(document.getElementById("map"), myOptions);  
  15. directionsDisplay.setMap(map);  
  16. directionsDisplay.setPanel(document.getElementById('directionpanel'));  
  17. var control = document.getElementById('control');  
  18. control.style.display = 'block';  
  19. }  
  20. function calcRoute() {  
  21. var start = document.getElementById('startvalue').value;  
  22. var end = document.getElementById('endvalue').value;  
  23. var request = {  
  24. origin: start,  
  25. destination: end,  
  26. travelMode: google.maps.DirectionsTravelMode.DRIVING  
  27. };  
  28. directionsService.route(request, function (response, status) {  
  29. if (status == google.maps.DirectionsStatus.OK) {  
  30. directionsDisplay.setDirections(response);  
  31. }  
  32. });  
  33. }  
  34. function Button1_onclick() {  
  35. calcRoute();  
  36. }  
  37. window.onload = InitializeMap;  
  38. </script>  
  39. <table id ="control">  
  40. <tr>  
  41. <td>  
  42. <table>  
  43. <tr>  
  44. <td>From:</td>  
  45. <td>  
  46. <input id="startvalue" type="text" style="width: 305px" /></td>  
  47. </tr>  
  48. <tr>  
  49. <td>To:</td>  
  50. <td><input id="endvalue" type="text" style="width: 301px" /></td>  
  51. </tr>  
  52. <tr>  
  53. <td align ="right">  
  54. <input id="Button1" type="button" value="GetDirections" onclick="return Button1_onclick()" /></td>  
  55. </tr>  
  56. </table>  
  57. </td>  
  58. </tr>  
  59. <tr>  
  60. <td valign ="top">  
  61. <div id ="directionpanel" style="height: 390px;overflow: auto" ></div>  
  62. </td>  
  63. <td valign ="top">  
  64. <div id ="map" style="height: 390px; width: 489px"></div>  
  65. </td>  
  66. </tr>  
  67. </table> 
Display Side
 

Answers (1)