send data from google api v3 javascript to c#
-
hi all , i want to sent latitude & longitude on click on map to c# windows form textbox_latitude & textbox_longitude this code send latitude & longitude on click on map but it send it to html input type="text" name="lat" ,input type="text" name="lng" i want to transfer var lat , var lng to c# windows form textbox_latitude & textbox_longitude <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Google Maps JavaScript API v3 Example: Dragable and clickable marker with lat and lang in form</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var map; function initialize() { var myLatlng = new google.maps.LatLng(30.050077, 31.238594); var myOptions = { zoom: 7, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var infowindow = new google.maps.InfoWindow({ content: "Drag marker to position
or click to place" }); infowindow.open(map); google.maps.event.addListener(map, 'click', function(event) { var clickedLocation = new google.maps.LatLng(event.latLng); var marker = new google.maps.Marker({ position: event.latLng, title:"Marker position", draggable: true, map: map }); infowindow.open(map,marker); map.setCenter(event.latLng); google.maps.event.addListener(map, 'click', function(event) { marker.setMap(null); }); google.maps.event.addListener(marker, 'dragend', function(event) { var point = event.latLng; var lat = point.lat(); var lng = point.lng(); document.getElementById("frmLat").value = lat; document.getElementById("frmLon").value = lng; }); var point = event.latLng; var lat = point.lat(); var lng = point.lng(); document.getElementById("frmLat").value = lat; document.getElementById("frmLon").value = lng; }); } </script> </head> <body onLoad="initialize()">Lat: <input type="text" name="lat" id="frmLat" >
Lng: <input type="text" name="lng -
hi all , i want to sent latitude & longitude on click on map to c# windows form textbox_latitude & textbox_longitude this code send latitude & longitude on click on map but it send it to html input type="text" name="lat" ,input type="text" name="lng" i want to transfer var lat , var lng to c# windows form textbox_latitude & textbox_longitude <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Google Maps JavaScript API v3 Example: Dragable and clickable marker with lat and lang in form</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var map; function initialize() { var myLatlng = new google.maps.LatLng(30.050077, 31.238594); var myOptions = { zoom: 7, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var infowindow = new google.maps.InfoWindow({ content: "Drag marker to position
or click to place" }); infowindow.open(map); google.maps.event.addListener(map, 'click', function(event) { var clickedLocation = new google.maps.LatLng(event.latLng); var marker = new google.maps.Marker({ position: event.latLng, title:"Marker position", draggable: true, map: map }); infowindow.open(map,marker); map.setCenter(event.latLng); google.maps.event.addListener(map, 'click', function(event) { marker.setMap(null); }); google.maps.event.addListener(marker, 'dragend', function(event) { var point = event.latLng; var lat = point.lat(); var lng = point.lng(); document.getElementById("frmLat").value = lat; document.getElementById("frmLon").value = lng; }); var point = event.latLng; var lat = point.lat(); var lng = point.lng(); document.getElementById("frmLat").value = lat; document.getElementById("frmLon").value = lng; }); } </script> </head> <body onLoad="initialize()">Lat: <input type="text" name="lat" id="frmLat" >
Lng: <input type="text" name="lngAre you using the WebBrowser control? If so, add a script to the HTML document that returns the values of interest; then (from the Windows Form) call the WebBrowser.InvokeScript method with the name of the script and populate the form's controls / properties with the returned values.
-
hi all , i want to sent latitude & longitude on click on map to c# windows form textbox_latitude & textbox_longitude this code send latitude & longitude on click on map but it send it to html input type="text" name="lat" ,input type="text" name="lng" i want to transfer var lat , var lng to c# windows form textbox_latitude & textbox_longitude <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Google Maps JavaScript API v3 Example: Dragable and clickable marker with lat and lang in form</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var map; function initialize() { var myLatlng = new google.maps.LatLng(30.050077, 31.238594); var myOptions = { zoom: 7, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var infowindow = new google.maps.InfoWindow({ content: "Drag marker to position
or click to place" }); infowindow.open(map); google.maps.event.addListener(map, 'click', function(event) { var clickedLocation = new google.maps.LatLng(event.latLng); var marker = new google.maps.Marker({ position: event.latLng, title:"Marker position", draggable: true, map: map }); infowindow.open(map,marker); map.setCenter(event.latLng); google.maps.event.addListener(map, 'click', function(event) { marker.setMap(null); }); google.maps.event.addListener(marker, 'dragend', function(event) { var point = event.latLng; var lat = point.lat(); var lng = point.lng(); document.getElementById("frmLat").value = lat; document.getElementById("frmLon").value = lng; }); var point = event.latLng; var lat = point.lat(); var lng = point.lng(); document.getElementById("frmLat").value = lat; document.getElementById("frmLon").value = lng; }); } </script> </head> <body onLoad="initialize()">Lat: <input type="text" name="lat" id="frmLat" >
Lng: <input type="text" name="lngI believe my answer to your previous question (http://www.codeproject.com/Messages/4243389/Re-csharp-windows-form-google-api-v3.aspx[^]) actually contains answer to this question. Check the first half of that answer for more information.
-
I believe my answer to your previous question (http://www.codeproject.com/Messages/4243389/Re-csharp-windows-form-google-api-v3.aspx[^]) actually contains answer to this question. Check the first half of that answer for more information.
loyal ginger wrote:
I believe my answer to your previous question (http://www.codeproject.com/Messages/4243389/Re-csharp-windows-form-google-api-v3.aspx[^]) actually contains answer to this question. Check the first half of that answer for more information.
when i use first From JavaScript to C# i have this error in javascript: unable to get property 'report_location' object is null or undefiend see image please : http://www.mediafire.com/?rh2ml2645fajoio[^] do you know why this error appeared i am really appreciate your help thanks in advance
-
loyal ginger wrote:
I believe my answer to your previous question (http://www.codeproject.com/Messages/4243389/Re-csharp-windows-form-google-api-v3.aspx[^]) actually contains answer to this question. Check the first half of that answer for more information.
when i use first From JavaScript to C# i have this error in javascript: unable to get property 'report_location' object is null or undefiend see image please : http://www.mediafire.com/?rh2ml2645fajoio[^] do you know why this error appeared i am really appreciate your help thanks in advance
I failed to mention that you need to specify that the WinForm object is going to be used for the scripting from JavaScript. The following property should be updated from your WinForm class:
webBrowser1.ObjectForScripting = this;
Sorry for this oversight.