MaryFan24 0 Newbie Poster

Hi, I am trying to develop a website that displays a google map and some markers that I want to add from my SQL Server Database. I have tried to get the values(Latitude and Longitude) from the database in the asp.net and pass them to javascript to add a marker to the map.

The asp code I have is:

<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="SELECT * FROM [Component]"></asp:SqlDataSource>
        <input type="hidden" id="lat" value="<%#Eval("Latitude") %>" />
        <input type="hidden" id="lng" value="<%#Eval("Longitude")%>)" />
        
<div id="map_canvas" style="width: 100%; height: 450px">
    </div>

And then the javascript that creates the map:

function initialize() {
        if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map_canvas"));
            map.setCenter(new GLatLng(51.89942, -8.470527), 15);
            map.setUIToDefault();

            var point = new GLatLng(document.getElementById("lat"), document.getElementById("lng"));
            map.addOverlay(new GMarker(point, markerOptions));

        }
    }

The map is created and added to the page but its not pulling the latitude and longitude values to add to the map.

Anyone any ideas?