0

I am integrating bing maps into a web page. I am calling the GetDirections() method of my VEMap option. and setting the VERouteOptions.ShowDisambiguation property to true when I call VEMap.GetDirections(). So sometimes I get the following dialog:

'Select A Location' Dialog http://img249.imageshack.us/img249/6153/bingdisambiguationdialo.png

The problem is sometimes the user will enter a second set of directions into my form, and dialog remains. I've done the following to to correct it:

    // In case the disambiguation dialog a.k.a "" is present from a previous direction search
    $('#myMap_veplacelistpanel').hide();

It seems to work, but it feels like a suboptimal approach. Is there a better way to do it?

UPDATE: Originally I was deleting the dialog. This caused problems so I just hide it now, and that solved the problems it created. Since I have not yet accepted my self answer, I am changing the question I changed the question to reflect it.

Justin Dearing
  • 14,270
  • 22
  • 88
  • 161

2 Answers2

2

Rather then hiding the div with CSS, you can make the following call to disable the dialog:

map.ShowDisambiguationDialog(false);

That should solve your problem.

You can also modify the map.Find parameters to disable the dialog box:

map.Find(what, where, type [VEFindType.Business], layer [base map], startIndex [0], numberOfResults [10], showResults[true], createResults [true], useDefaultDisambiguation [true], setBestMapView [true], callback)

For example: map.Find(null, searchstr, null, null, null, null, false, null, false, false, AddPin);

Source: http://msdn.microsoft.com/en-us/library/bb545005.aspx

dexus
  • 86
  • 1
  • 5
0

There is a problem with my previous approach. You need to hide the disambiguation dialog, not remove it, otherwise you get javascript errors if you enter an incomplete address a second time. Apparently the dialog is not regenerated every time an incomplete address is entered, its content is just replaces.

Justin Dearing
  • 14,270
  • 22
  • 88
  • 161