Velio pls help : problem adding Simple Text Autocomplete

Feb 28, 2013 at 8:32 PM
Hi,

I have a major problem.

I have a simple aspx web page with this simple code :
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script>

      <script>
          function initialize2() {
              var input2 = document.getElementById('searchTextField');
              var autocomplete = new google.maps.places.Autocomplete(input2);

              var infowindow2 = new google.maps.InfoWindow();

              google.maps.event.addListener(autocomplete, 'place_changed', function () {
                  infowindow2.close();
                  input2.className = '';
                  var place2 = autocomplete.getPlace();
                  if (!place2.geometry) {
                      // Inform the user that the place was not found and return.
                      input2.className = 'notfound';
                      return;
                  }
                  infowindow2.setContent('<div><strong>' + place2.name + '</strong><br>' + address2);
                  infowindow2.open(map2, marker2);
              });

          }
          google.maps.event.addDomListener(window, 'load', initialize2);
    </script>
Its working perfectly
But when I add an "artem:GoogleMap" Control on my page,
Nothing works anymore.....

Can you give me a clue of what is going on ?
Mar 5, 2013 at 2:59 PM
Plz, my project is frozen on this.
I really need that little help, that little moment of your time.
Mar 5, 2013 at 5:06 PM
Hi, Tgaud!

I'm not 100% sure, but I do believe that as you want to use Artem:GoogleMap control you must delete the script you already have in your page.

You should have something like this:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm2.aspx.vb" Inherits="GoogleMaps_SubGurim.WebForm2" %>
<%@ Register assembly="Artem.Google" namespace="Artem.Google.UI" tagprefix="artem" %>
<!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 runat="server">
    <title>GoogleMaps - Using Artem Control</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div id="divMap" runat="server" visible="false">
                    <artem:GoogleMap ID="GoogleMap" runat="server" Width="952px" Height="230px"/>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>    
    </div>
    </form>
</body>
</html>
And, in code-behind (VB), you should have something like this:
Imports Artem.Google.UI

Public Class WebForm2
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim lat As Double = -22.5322
        Dim lng As Double = -44.635899999999999
        Dim marcaTorre As New Marker
        Dim posicao As New LatLng(lat, lng)
        marcaTorre.Icon = "../Imagens/Torre_PR.png"
        marcaTorre.Position = posicao
        GoogleMap.Center = posicao
        GoogleMap.Key = "YourGoogleMapKey"
        GoogleMap.EnableScrollWheelZoom = True
        GoogleMap.EnableMapTypeControl = True
        GoogleMap.Zoom = 15
        GoogleMap.Markers.Add(marcaTorre)
    End Sub

End Class
Hope this help you.
Paulo Ricardo Ferreira
Rio de Janeiro - Brasil
Mar 5, 2013 at 5:23 PM
Edited Mar 5, 2013 at 5:24 PM
Sorry we misunderstood.
But The googleMap control is working..... alone.

And my custom javascript code (google autocompletion of addresses, on textbox) is working, alone.
using
 "https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"
("libraries=places" at the end, is important)

but when I put both together on the same page... nothing works anymore.
Mar 5, 2013 at 5:44 PM
Hi, Tgaud!

I'm not an expert in using this Artem:GoogleMap control. In fact I started using it last week.

But, as previously written, I don't believe you'll be able to use both in your page. I think you should dig a little more in Artem:GoogleMap control and verify wether there's already something to accomplish the things you have in your javascript code. Take a look at this link.

Hope this help.

Paulo Ricardo Ferreira
Rio de Janeiro - Brasil
Mar 5, 2013 at 5:48 PM
Edited Mar 5, 2013 at 5:48 PM
Hi pauloric!

No i checked, and there isn't :(
I tried to customize it, to include my JS code, but sadly , even after severals days, i'm not good enough to make it work, cuz i dont rlly understand how it works.
Mar 6, 2013 at 9:53 PM
veliooooooooooo