Iβm doing a school project, I need to make a simple website, add Google maps to it, read, say, 100 different addresses from a text file and show these locations on Google maps using markers.
Now I am trying to add google maps to an ASP.net page using javascript, which I saw in Google map tutorials. And there is this problem that I have to convert the addresses to coordinates. Therefore, for this I use
function addAddressToMap(response) { if (!response || response.Status.code != 200) { alert("Sorry, we were unable to geocode that address"); } else { place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]); marker = new GMarker(point); map.addOverlay(marker); marker.openInfoWindowHtml(place.address + '<br>' + '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode); } }
these functions, and they work fine. But my problem here is that I need to get this address data from a text file. But in order to get them, I need to use several different codes. And I want to do this server side with C # codes. But I do not know how to write codes on the server side, and then return something on the HTML side as an address. I hope you understand. Thanks for the help.
Update:
Server code: public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Page.ClientScript.RegisterArrayDeclaration("Skills", "'asa'"); Page.ClientScript.RegisterArrayDeclaration("Skills", "'bell'"); Page.ClientScript.RegisterArrayDeclaration("Skills", "'C'"); Page.ClientScript.RegisterArrayDeclaration("Skills", "'C++'"); } } Client side: function showLocation() { var address = "izmit"; var address2 = "aΔrΔ±"; geocoder.getLocations(Skills[0], addAddressToMap); }
Now, if I use "asa" instead of Skills [0], it will show the location and mark, but with skills [0] it does not work. And thanks for your reply, this is what I am looking for.
even if I try var MyValue = Skills [0]; and then use MyValue instead of Skills [0], it still doesn't work