Just curious, why do they need to be server side textbox?
Their json result request can handle just about any query you can throw at it. Simply concatenate your text boxes into a search query separated by commas.
function callSearchService(credentials) {
var searchString =document.getElementById('txtStreetNum').value + ' ' + document.getElementById('txtQueryStr').value + ' , ' + document.getElementById('txtQueryCity').value + ' , ' + document.getElementById('txtQueryState').value + ' , ' + document.getElementById('txtQueryPostal').value;
var geocodeRequest = "http://dev.virtualearth.net/REST/v1/Locations?query=" + encodeURI(searchString) + "&output=json&jsonp=searchServiceCallback&key=" + credentials;
}
If for some reason, you really need to get the text from an asp.net text control (Maybe you want to pre-load it for a user), you can do it like this;
var aspTextBoxValue = '<%=ASPTextBox.Text%>';
To make it add different pushpins for different query box's you will need to do a few things:
- Concatenate separate searchStrings per query (
callSearchService
for each query)
- Make geocodeRequests for each query.
- Parse each result object and display the pushpin as seen in
searchServiceCallback
in the following example:
(Your example doesnt actually resemble and query / response parsing at all, here's one more suitable)
Query and Response in Bing Maps
Don't expect my syntax to be perfect, although it may be error free, I'm just getting you off on the right foot without doing it for you. :)