Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all
I have posted this question before and even thou someone gave me a great article to read. I must admit it was way over my head. To simplify and if someone can just assist me with his issue it would be greatly appreciated. Here is my problem. I have a JavaScript code in google map that reference and image from a location on my website. the JavaScript function looks like this.

C#
function createMarker(point, html, StartEnd) {
    var markerImage = "Images/AirplaneIcon.gif";
    var markerIcon = new GIcon(G_DEFAULT_ICON);
    markerIcon.image = markerImage;
    markerIcon.iconSize = new GSize(50, 50);
    markerIcon.iconAnchor = new GPoint(25, 25);
    var markerImage2 = "/Icons/IntersectionIconRed.png";
    var markerIcon2 = new GIcon(G_DEFAULT_ICON);
    markerIcon2.image = markerImage2;
    markerIcon2.iconSize = new GSize(25, 25);
    markerIcon2.iconAnchor = new GPoint(20, 20);
//    var markerImage2 = "http://localhost:3301/icons/Icons.aspx";

//    var markerIcon2 = new GIcon(G_DEFAULT_ICON);
//    markerIcon2.image = markerImage2;
//    markerIcon2.iconSize = new GSize(25, 25);
//    markerIcon2.iconAnchor = new GPoint(20, 20);

    var marker;
    if (StartEnd == "true") {
        marker = new GMarker(point, { icon: markerIcon });
    }
    else {
        marker = new GMarker(point, { icon: markerIcon2 });
    }
    GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(html);
    });
    return marker;
}


I need to be able to call the markerImage from the code behind server side event. I have tried several attempts to figure it out but with no luck. Including GetByElementID, placing using an asp image and so on.. Can someone please help.

Thank you:confused::confused::confused::confused:
Posted
Comments
senguptaamlan 13-Sep-10 2:04am    
Hi, just want to know why you want to access the markerImage from server side event handler...it will be very helpful if you can give a bit more details regarding the scenario...
ArtificerGM 24-May-11 15:44pm    
I'm an old school JavaScript programmer and HATE .Net's AJAX controls so I couldn't give you much info on that, BUT, I can tell you that a tried and true way of calling this would be to invoke the __doPostBack() method via a JavaScript click event attached to the Map Marker.

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