Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Google-Maps HTML5 Bing
Hi I have this following code:
 
function reverseGeocodeRequest() {
          createSearchManager();
          var userData = { name: 'Maps Test User', id: 'XYZ' };
          map.setView({ zoom: 10 });
          var request =
          {
              location: new Microsoft.Maps.Location(38.711232538952245, -9.13513183593749),
              callback: onReverseGeocodeSuccess,
              errorCallback: onReverseGeocodeFailed,
              userData: userData
          };
          searchManager.reverseGeocode(request);
      }
But the coordinates are inserted manually, I want to give that values by textbox´s can anyone help me?
 
Regards.
Posted 28-Aug-12 0:02am
hh_7643
Edited 28-Aug-12 10:06am
digimanus33.4K
v2
Comments
enhzflep at 28-Aug-12 15:28pm
   
Step 1. - Add two input boxes. Make them uniquely identifiable (give them a unique id)
Step 2. - use document.getElementById('yourElementId') to get the element
Step 3. - use .value to get the text in an input text-box
 
<input id='longInput'/>
<input id='latInput'/>
longElem = document.getElementById('longInput');
longVal = longElem.value;
latElem = document.getElementById('latInput');
latVal = latElem.value;
 
------
function reverseGocodeRequest(longitude, latitude)
..
..
var request =
{
location: new Microsoft.Maps.Location(longitude, latitude),
..
..
etc.
Hugo Henrique at 29-Aug-12 4:29am
   
Thanks!!

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

function reverseGeocodeRequest() {
          var latitude = document.getElementById('txtLatitude').value;
          var longitude = document.getElementById('txtLongitude').value;
          createSearchManager();
          var userData = { name: 'Maps Test User', id: 'XYZ' };
          map.setView({ zoom: 10 });
          var request =
          {
              location: new Microsoft.Maps.Location(latitude, longitude),
              callback: onReverseGeocodeSuccess,
              errorCallback: onReverseGeocodeFailed,
              userData: userData
          };
          searchManager.reverseGeocode(request);
      }
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 495
1 Sergey Alexandrovich Kryukov 424
2 OriginalGriff 360
3 Abhinav S 250
4 CHill60 240
0 Sergey Alexandrovich Kryukov 10,102
1 OriginalGriff 9,495
2 Peter Leow 5,241
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,076


Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 28 Aug 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100