javascript - Populating Google Maps with Markers from C# List -
I am trying to populate a Javascript Google map with a C # list of the Google Map marker. I can get data from public floats, but not from the list. The list will be populated in the database but in this case the list is hard coded. I have a hard coded marker included. Any ideas?
ASP.NET Web Form
& lt; Title & gt; & Lt; / Title & gt; & Lt; Script type = "text / javascript" src = "http://maps.googleapis.com/maps/api/js?sensor=false" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Function InitializeMap () {var latlng = new google.maps.LatLng ('& lt;% = lat%>', '<% = lng% & gt;'); Var myOptions = {Zoom: 9, Center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP}; Var map = new google.maps.Map (document.getElementById ("map"), myOptions); Placement (A, 1, 1); Var marker = new google.maps.marker ({status: latlng, map: map, title: 'test!'}); } //window.onload = InitializeMap (); & Lt; / Script & gt;
C #
public class placement {get public string placement name { Set; } Receive the latitude of the public float; Set; } Receive public float geometry; Set; } Public List & lt; Placement & gt; GetPlacementDetails () {Placement Placement = New Placement (); Placement. Placement name = "placement1"; Placement.litid = 53.280 9 7170166426f; Placement. Numerology = -2.9433422088622f; Placement placement 2 = new placement (); Placement 2 PlacementName = "Placement 2"; Placement 2 Latitude = 55.74326998205062f; Placement 2 Longitude = -2.869 99988555 9F; & Lt; Placement & gt; Placement = new list & lt; Placement & gt; (); Placements.Add (placement); Placements.Add (placement2); Return placement; }
You must create a service to access data
Comments
Post a Comment