Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I have found a script that enables me to display a Google map with marker icons. My problem is I need to depending on the information I receive from the database i need to display a different icon. I am trying to call the marker icon from the code behind in asp.net SO far I have been able to get the popup tom work but to change the static icon I have had no luck.
Both code pages are below any help would be appreciated.

Function I am trying to call is

C#
function createMarker(point, html, StartEnd) {
    var markerImage
    var markerIcon = new GIcon(G_DEFAULT_ICON);
    markerIcon.image = markerImage;
    markerIcon.iconSize = new GSize(50, 50);
    markerIcon.iconAnchor = new GPoint(25, 25);
    var marker;
    if (StartEnd == "true") {
        marker = new GMarker(point, { icon: markerIcon });
    }
    else {
        marker = new GMarker(point);
    }
    GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(html);
    });
    return marker;
}



this is the aspx.cs file

XML
StringBuilder sbx = new StringBuilder();
              sbx.Append("<script language=javascript>      createMarker() { var markerIcon = []; ");
              sbx.Append("Image markerImage = new Image()");
              //markerIcon.
              sbx.Append("ImageUrl = ~/Images/AirplaneIcon.gif");
              sbx.Append("}</script>");
              Page.RegisterStartupScript("createMarker", sbx.ToString());
Posted

1 solution

Did you see my article ..

You will get entire help on Marker from it.

Google Maps in HTML, ASP.NET, PHP, JSP etc. with ease[^]
 
Share this answer
 
Comments
Dalek Dave 9-Sep-10 20:26pm    
Good link to good article.
Abhishek Sur 12-Sep-10 7:56am    
Thank you Dalek.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900