Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. send data from google api v3 javascript to c#

send data from google api v3 javascript to c#

Scheduled Pinned Locked Moved C#
javascriptcsharphtmlcomiot
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mrx100
    wrote on last edited by
    #1

    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

    L L 2 Replies Last reply
    0
    • M mrx100

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Are 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.

      1 Reply Last reply
      0
      • M mrx100

        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

        L Offline
        L Offline
        loyal ginger
        wrote on last edited by
        #3

        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.

        M 1 Reply Last reply
        0
        • L loyal ginger

          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.

          M Offline
          M Offline
          mrx100
          wrote on last edited by
          #4

          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

          L 1 Reply Last reply
          0
          • M mrx100

            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

            L Offline
            L Offline
            loyal ginger
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups