This project is read-only.

Include a number or letter on a Marker

Jul 3, 2011 at 1:07 PM

Is there a way to include a number or letter to display on the marker? I would like to display a series of markers on the map each with a unique label on each Marker.



Jul 25, 2011 at 5:33 PM

Does anyone know if this type of functionality included in the map control?

I was thinking of just creating marker icons labeled 1-25 and loading the appropriate icon name that cooresponds with the row number +1

Any other ideas would be helpful.



Jul 26, 2011 at 12:48 PM

See and my post there.  The custom label line "label = new ELabel(new GLatLng(" & objPin.Latitude & "," & objPin.Longitude & "), """ & sMarker & """, ""locationlabel""); GoogleMap1.addOverlay(label);" creates the text (sMarker is the variable in the function call).

Jul 27, 2011 at 6:45 AM

Thanks TMCentral,

 To test, I tried it with 1 marker in a page_load event. The generic marker appears in the map but not the overlay.  I also have the  locationlabel css class defined with my image


Am I doing something wrong?

         If Not IsPostBack Then
                Dim m As New Artem.Google.UI.GoogleMarker

                m.Latitude = 26.150168
                m.Longitude = -80.273686
                m.Title = "Sunrise"

                Dim sMarker As String = "Sunrise"
                Dim sbCustomMarkerBuilder As New StringBuilder("")
                sbCustomMarkerBuilder.Appendline("var label;")
                sbCustomMarkerBuilder.Append("label = new ELabel(new GLatLng(" & m.Latitude.toString & "," & m.Longitude.toString & "), """ & sMarker & """, ""locationlabel""); GoogleMap1.addOverlay(label);")

                Me.GoogleMap1.OnClientMapLoad = sbCustomMarkerBuilder.ToString

            Catch ex As Exception
                Throw (Ex)
            End Try
        End If

Jul 27, 2011 at 1:43 PM

I only use one-or-the-other (i.e., a "regular" Artem-created marker or the custom one) - I've never tried both. 

Probably your biggest issue is that it should be in page_init I believe; I think someone else asked me about this not too long ago - if its in Page_load the OnClientMapLoad has already initialized (and maybe even fired - I don't remember).  

If that doesn't work I'd recommend using Chrome and its built-in JS debugging.... 

Let me know how you progress!

Jul 27, 2011 at 3:59 PM

I initially tried it without added the Artem Marker. When nothing appeared I thought maybe that I needed to do both.  I was thinking that about page_init vs. load. Same results for page_init.

I also tried adding the map control dynamically and including the overlay script. same thing.

Just in case this info is helpful; I am running  Version 5 of the map control on localhost.

In the browser page source (IE8 and Firefox), the following appears near the bottom of the page in script tags,  in a sys.application.add_init function

$create(Artem.Google.Map, {"clientMapID":"GoogleMap1","clientStateID":"GoogleMap1_ClientState","name":"GoogleMap1"}, {"load":"var label;\r\nlabel = new ELabel(new GLatLng(26.150168,-80.273686), \"Sunrise\", \"locationlabel\"); GoogleMap1.addOverlay(label);"}, null, $get("GoogleMap1"));


I'll try Chrome.




Jul 27, 2011 at 4:48 PM

Ah - that is probably it - the code I gave you was using v4.1 of the component which (if I remember correctly) uses v2 of the Maps API while v5 uses v3 of the API so I'm sure there are breaking changes.  AFAIK, v5 is still alpha so we've not done any work with it.  However, using v4.1 we create 2k+ custom markers on the same map without issue.

Jul 28, 2011 at 1:25 AM


OK that makes sense. I guess I should have disclosed the version up front. Can I run Artem  4.1 on a site running .Net 3.5?

Either way, Thanks for your help.  The solution you offered looks like  a smart approach.



Jul 28, 2011 at 1:01 PM
Edited Jul 28, 2011 at 1:05 PM

AFAIK, there is little issue - our app for this is compiled in VS2010 (but targeted for .NET v2); we also run .NET v2 components in v4 apps (at least I think we do) - I believe you simply need the whole version you're on and the correct version for the DLL also; easy enough to check; just remove the current ref and add the new one!

Feb 20, 2012 at 2:30 PM

Which would be the way to create this injected code in v6 without the OnClientMapLoad method?