javascript - Google Maps Routing with Waypoints from DB -
i have c# webforms application , i'm trying use google maps routing waypoints according example google maps api site. https://developers.google.com/maps/documentation/javascript/examples/directions-waypoints#try-it-yourself
this example represents want except want of points sql database rather dropdown lists shown. essentially, want loop through datareader , map/route points. data stored procedure. don't know how stored procedure results on java script.
thanks suggestions.
clarifying little, here have currently: in c# i'm calling stored procedure gets lat/long values db.
private void loadarray() { //get lat long db load google array. sqlconnection conn = new sqlconnection(); sqlcommand cmd = new sqlcommand(); string connstr = configurationmanager.connectionstrings["furnituredb"].connectionstring; conn.connectionstring = connstr; conn.open(); cmd.commandtype = commandtype.storedprocedure; cmd.connection = conn; cmd.commandtext = "getgooglepins"; sqldatareader datareader = cmd.executereader(); var dtarray = new datatable(); dtarray.load(datareader); }
on client side have:
function calculateanddisplayroute(directionsservice, directionsdisplay) { var waypts = []; var checkboxarray = document.getelementbyid('waypoints'); (var = 0; < checkboxarray.length; i++) { if (checkboxarray.options[i].selected) { waypts.push({ location: checkboxarray[i].value, stopover: true }); } }
i want replace 'waypoints' values dtarray.
Comments
Post a Comment