Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoogleMap on editperoperty.ascx #16

Open
uzmannazari opened this issue Jul 9, 2019 · 0 comments
Open

GoogleMap on editperoperty.ascx #16

uzmannazari opened this issue Jul 9, 2019 · 0 comments

Comments

@uzmannazari
Copy link

hi
we need to change a javascript codes related to google map in editproperty.ascx file but i dont know anything about googlemap api v3. can anyone change this code to map v3?
<script type="text/javascript">

                function KeyDownHandler()
                {
                
                    // process only the Enter key
                    if (event.keyCode == 13)
                    {
                        alert(event.keyCode);
                        // cancel the default submit
                        event.returnValue=false;
                        event.cancel = true;
                        
                       showAddress(address.value);
                    }
                }

                function load() {
                    if (GBrowserIsCompatible()) {
                        var map = new GMap2(document.getElementById("map"));
                        map.addControl(new GSmallMapControl());
                        map.addControl(new GMapTypeControl());
                        
                        geocoder = new GClientGeocoder();
                        
                        <asp:literal id="litMapCenter" runat="server" />
                        <asp:placeholder id="phMapLoad" runat="server">
                        var marker = new GMarker(center, {draggable: true});  
                        map.addOverlay(marker);
                        document.getElementById("<%= txtLatitude.ClientID %>").value = center.lat().toFixed(5);
                        document.getElementById("<%= txtLongitude.ClientID %>").value = center.lng().toFixed(5);

                      GEvent.addListener(marker, "dragend", function() {
                       var point = marker.getPoint();
                          map.panTo(point);
                       document.getElementById("<%= txtLatitude.ClientID %>").innerHTML = point.lat().toFixed(5);
                       document.getElementById("<%= txtLongitude.ClientID %>").innerHTML = point.lng().toFixed(5);

                    });

                    GEvent.addListener(map, "moveend", function() {
                        map.clearOverlays();
                        var center = map.getCenter();
                        var marker = new GMarker(center, {draggable: true});
                        map.addOverlay(marker);
                        document.getElementById("<%= txtLatitude.ClientID %>").value = center.lat().toFixed(5);
                        document.getElementById("<%= txtLongitude.ClientID %>").value = center.lng().toFixed(5);

                        GEvent.addListener(marker, "dragend", function() {
                            var point =marker.getPoint();
                            map.panTo(point);
                            document.getElementById("<%= txtLatitude.ClientID %>").value = point.lat().toFixed(5);
                            document.getElementById("<%= txtLongitude.ClientID %>").value = point.lng().toFixed(5);
                        });
                    });

                        </asp:placeholder>
                  }
                }

                   function showAddress(address) {
                   var map = new GMap2(document.getElementById("map"));
                   map.addControl(new GSmallMapControl());
                   map.addControl(new GMapTypeControl());
                   if (geocoder) {
                    geocoder.getLatLng(
                      address,
                      function(point) {
                        if (!point) {
                          alert(address + " not found");
                        } else {
	                  document.getElementById("<%= txtLatitude.ClientID %>").value = point.lat().toFixed(5);
                   document.getElementById("<%= txtLongitude.ClientID %>").value = point.lng().toFixed(5);
	                 map.clearOverlays()
		                map.setCenter(point, 14);
               var marker = new GMarker(point, {draggable: true});  
	                 map.addOverlay(marker);

	                GEvent.addListener(marker, "dragend", function() {
                  var pt = marker.getPoint();
                     map.panTo(pt);
                  document.getElementById("<%= txtLatitude.ClientID %>").value = pt.lat().toFixed(5);
                     document.getElementById("<%= txtLongitude.ClientID %>").value = pt.lng().toFixed(5);
                    });


                 GEvent.addListener(map, "moveend", function() {
	                  map.clearOverlays();
                var center = map.getCenter();
	                  var marker = new GMarker(center, {draggable: true});
	                  map.addOverlay(marker);
	                  document.getElementById("<%= txtLatitude.ClientID %>").value = center.lat().toFixed(5);
                   document.getElementById("<%= txtLongitude.ClientID %>").value = center.lng().toFixed(5);

                 GEvent.addListener(marker, "dragend", function() {
                 var pt = marker.getPoint();
                    map.panTo(pt);
                document.getElementById("<%= txtLatitude.ClientID %>").value = pt.lat().toFixed(5);
                   document.getElementById("<%= txtLongitude.ClientID %>").value = pt.lng().toFixed(5);
                    });
             
                    });

                        }
                      }
                    );
                  }
                }
                
                if (window.addEventListener)
                {
                    window.addEventListener("load", load, false);
                    window.attachEvent("onunload", GUnload); 
                }
                else if (window.attachEvent)
                {
                    window.attachEvent("onload", load);
                    //window.addEventListener("unload", GUnload, false);
                }
                </script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant